dinsdag 18 januari 2011

GAC assemblies with right-click

As a developer you'll often need to place an assembly into the GAC (Global Assemblie Cache).
There are several ways to do this. You can do it in command line with "gacutil -if 'assembly path'" or by dragging your assembly in explorer to "C:\Windows\assembly".

Well there is another even easier way to do this. By just adding a registry key, you can place an assembly into the GAC with a simple right-click, as you can see below.

br /> To achieve this you'll need to create the registry key.
This can be done by copying following code to notepad, and save it with the .reg extension. Now double-click the created .reg file to add the registry key.
That's it!

You can also change the shown text when you right-click by changing the 'GAC-It' (written in red) to the desired text.

*****************************************************************
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\dllfile\shell\GAC-It\command]
@="C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin\\NETFX 4.0 Tools\\gacutil.exe /if \"%1\""
*****************************************************************

By specifying the '/if', I choose to install an assembly into the global assembly cache. If an assembly with the same name already exists in the global assembly cache, the tool overwrites it.
(other possible parameters can be found here).

ATTENTION: the path to the gacutil.exe may be different on your pc. I've installed it on a 64-bit machine. you should verify the actual path of your gacutil.exe (may occur multiple times on your pc).

Source: http://biztalkia.blogspot.com/2005/12/easier-way-to-add-dll-to-gac.html

Geen opmerkingen:

Een reactie posten