How to: Install an assembly into the global assembly cache

The global assembly cache (GAC) stores assemblies that several applications share. Install an assembly into the global assembly cache with one of the following components:

Important

You can install only strong-named assemblies into the global assembly cache. For information about how to create a strong-named assembly, see How to: Sign an assembly with a strong name.

Windows Installer

Windows Installer, the Windows installation engine, is the recommended way to add assemblies to the global assembly cache. Windows Installer provides reference counting of assemblies in the global assembly cache and other benefits. To create an installer package for Windows Installer, use the WiX toolset extension for Visual Studio 2017.

Global Assembly Cache tool

You can use the .NET Global Assembly Cache utility (gacutil.exe) to add assemblies to the global assembly cache and to view the contents of the global assembly cache.

Note

Gacutil.exe is for development purposes only. Don't use it to install production assemblies into the global assembly cache.

The syntax for using gacutil.exe to install an assembly in the GAC is as follows:

gacutil -i <assembly name>

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

If gacutil.exe isn't in your system path, use the Developer command prompt for VS <version>.

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

gacutil -i hello.dll

Note

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

See also