where are the Gacutil and the Regasm tools? and how to use them

hi,

i was trying to learn how to build an IE toolbar, i found this articlehttp://www.codeproject.com/csharp/dotnetbandobjects.asp

i had build the assembly ,drag and drop it into the GAC but nothing happend,

then i used the gacutil /if , again nothing have been added to the IE toolbars

this article talk about a tool called regasm"register assembly" , i have C# express but i didn't find this tool in the SDK folder, so where can i find it? or is there any alternative to it,

thanks in advance

[698 byte] By [Egyptian] at [2007-12-23]
# 1
It is located with the .NET dlls. It appears that there is one for each version of the framework. On my computer, it is under C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

Another way to access regasm is with the Visual Studio Command Prompt (in Start -> Microsoft Visual Studio .NET 2003 -> Visual Studio .NET Tools).

Hope it helps!

sirjis at 2007-8-30 > top of Msdn Tech,Visual Studio Express Editions,Visual C# 2005 Express Edition...
# 2

hi,

thank you , i have found it in the path that you sent, "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"

if any one was interested in this question "How to register an Assembly in the GAC "Global Assembly cach" you can do that in 3 steps

  1. build your assembly but be sure it has a strong name, How to build assembly with a strong name ? you can right click your project > select properties > signing tab > check sign assembly > open chose a strong name file combobox > select new > give it a name and if you want to add a password you can add it

  2. move your assembly to the folder "C:\window\assembly" by drag and drop the dll which you build, or

    you can use the GacUtil which exists in this path "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin", you can use this utility but starting a command prompt , navigate to the folder where your dll lies, put the utility path between "", put the command prefexed by / ,then the assemblyName that you want to copy to GAC , so it will looks like something like this

    c:\Documents and settings\<My userName>\My Docuemtns\Visual Studio 2005\Projects\<MyBroject>\bin\Release > "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin", /if MyClassLib.Dll

  3. register the assembly by using Regasm utility which lies in this folder "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727" also you will use the command prompt for that i assume you still in the same path you used in the previous step so it will looks like this

    c:\Documents and settings\<My userName>\My Docuemtns\Visual Studio 2005\Projects\<MyBroject>\bin\Release > "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm" MyClassLib.Dll

you can substitute step 2 and 3 by using the IDE instead of the command prompt

in solution explorer right-clicking the project file, selecting 'Properties', selecting the 'Build events' tab, and in the 'post build' textbox add this code

cd $(ProjectDir)bin\release

"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil" /if MyClassLib.dll
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm" MyClassLib.dll

hope this might help anyone

Egyptian at 2007-8-30 > top of Msdn Tech,Visual Studio Express Editions,Visual C# 2005 Express Edition...
# 3

To avoid hard coding paths in the project pre/post build events, I do something like this:

call "$(DevEnvDir)..\..\vc\vcvarsall.bat" x86
regasm /codebase $(TargetDir)MYASM.dll
regedit /s $(ProjectDir)SOMETHING.reg

You can also see what env vars are available (e.g. %var%), just add SET as the first line and check your output window.

Hope this helps someone

ongle at 2007-8-30 > top of Msdn Tech,Visual Studio Express Editions,Visual C# 2005 Express Edition...