How to: Install an assembly into the global assembly cache

There are two ways to install a strong-named assembly into the global assembly cache (GAC).

Important

Only strong-named assemblies can be installed into the GAC. 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. You can use the WiX Toolset extension for Visual Studio 2017 to create an installer package for Windows Installer.

Global assembly cache tool

You can use the Global assembly cache tool (gacutil.exe) to add strong-named assemblies to the global assembly cache and to view the contents of the global assembly cache.

Note

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

The syntax for gacutil 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.

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 enabled you to install assemblies by dragging them in File Explorer. Beginning with the .NET Framework 4, Shfusion.dll is obsolete.

See also