1 out of 14 rated this helpful - Rate this topic

How to: Install an Assembly into the Global Assembly Cache

Updated: June 2010

There are three ways to install an assembly into the global assembly cache:

  • Using the Global Assembly Cache tool (Gacutil.exe).

    You can use Gacutil.exe to add strong-named assemblies to the global assembly cache and to view the contents of the global assembly cache.

    NoteNote

    Gacutil.exe is only for development purposes and should not be used to install production assemblies into the global assembly cache.

  • Using Microsoft Windows Installer 2.0.

    This is the recommended and most common way to add assemblies to the global assembly cache. The installer provides reference counting of assemblies in the global assembly cache, plus other benefits.

  • Using the Mscorcfg.msc (.NET Framework Configuration Tool).

    The Mscorcfg.msc (.NET Framework Configuration Tool) allows you to view the global assembly cache and add new assemblies to the cache.

NoteNote

In earlier versions of the .NET Framework, the Shfusion.dll Windows shell extension enabled you to install assemblies by dragging them in Windows Explorer. Beginning with the .NET Framework version 4, Shfusion.dll is obsolete.

To install a strong-named assembly into the global assembly cache using the Global Assembly Cache tool (Gacutil.exe)

  • At the command prompt, type the following command:

    gacutil –I <assembly name>

    In this command, assembly name is the name of the assembly to install in the global assembly cache.

The following example installs an assembly with the file name hello.dll into the global assembly cache.

gacutil -i hello.dll

Date

History

Reason

June 2010

Documented that Shfusion.dll is now obsolete.

Content bug fix.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
GAC
Should explain how to do it with windows installer.

"I like" 1'000'000
The path to Gacutil.exe for .NET 4.0 is...
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\gacutil.exe

Gacutil.exe is considered to be a development tool. Because of this it is only contained in the .NET SDK but not in the regular redistributable. Visual Studio comes with the SDK, so all Visual Studio users have it installed.

The tool's directory is also in %PATH% when you start a Visual Studio Command Prompt, so it can be used from there by simply typing "gacutil".
Incorrect information about using Mscorcfg.msc with 4.0
This article is supposedly targeted specifically for the .Net 4.0 framework and it mentions that you can view the gac using the Mscorcfg.msc, but if you refer to the related article about the Mscorcfg.msc  http://msdn.microsoft.com/en-us/library/2bc0cxhc.aspx  you will see that article specifically says that the Mscorcfg.msc has been removed from 4.0 framework.
Four is not the right number
Should also mention fifth method: by way of installer (such as use of Global Assembly Cache Folder in Visual Studio Deployment Project)
/ instead of -
$0It should be$0 $0gacutil /i hello.dll$0