Export (0) Print
Expand All

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 note 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.

  • Using Windows Installer.

    You do this in Visual Studio 2012 and Visual Studio 2013 by creating an InstallShield Limited Edition Project.

    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 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.

    Note Note

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

Note 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.

To use 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

For more information, see Global Assembly Cache tool (Gacutil.exe).

To use an InstallShield Limited Edition Project

  1. Add a setup and deployment package to your solution by opening the shortcut menu for your solution, and then choosing Add, New Project.

  2. In the Add New Project dialog box, in the Installed folder, choose Other Project Types, Setup and Deployment, InstallShield Limited Edition, and give your project a name. (If prompted, download, install, and activate InstallShield.)

  3. Perform the general configuration of your setup and deployment project either by using the Project Assistant in Solution Explorer, or by choosing the substeps of the numbered steps in the Solution Explorer. Configure your setup as you would if you were not adding assemblies to the GAC.

  4. To begin the process of adding an assembly to the GAC, choose Files, which is under the Specify Application Data step in Solution Explorer.

  5. In the Destination computer's folders pane, open the shortcut menu for Destination Computer, and then choose Show Predefined Folder, [GlobalAssemblyCache].

  6. For each project in the solution that contains an assembly that you want to install in the global assembly cache:

    1. In the Source computer's folders pane, choose the project.

    2. In the Destination computer's folders pane, choose [GlobalAssemblyCache].

    3. In the Source computer's files pane, choose Primary output from <project_name>.

    4. Drag the file in step c to the Destination computer's files pane (or use the Copy and Paste commands from the file's shortcut menu).

Show:
© 2014 Microsoft