[Originally posted by]: https://msdn.microsoft.com/en-us/library/dkkx7f79(v=vs.110).aspx
There are two ways to install a strong-named assembly into the global assembly cache (GAC):
|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 Gacutil.exe is only for development purposes and should not be used to install production assemblies into the global assembly cache.
|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
Add a setup and deployment package to your solution by opening the shortcut menu for your solution, and then choosing Add, New Project.
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.)
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.
To begin the process of adding an assembly to the GAC, choose Files, which is under the Specify Application Data step in Solution Explorer.
In the Destination computer’s folders pane, open the shortcut menu for Destination Computer, and then choose Show Predefined Folder,[GlobalAssemblyCache].
For each project in the solution that contains an assembly that you want to install in the global assembly cache:
- In the Source computer’s folders pane, choose the project.
- In the Destination computer’s folders pane, choose [GlobalAssemblyCache].
- In the Source computer’s files pane, choose Primary output from <project_name>.
- 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).