If you intend to share an assembly among several applications, you can install it into the global assembly cache. There are two ways to deploy an assembly into the global assembly cache:
- Use an installer designed to work with the global assembly cache. This is the preferred option for installing assemblies into the global assembly cache.
- Use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the Windows Software Development Kit (SDK).
You should share assemblies by installing them into the global assembly cache only when necessary. As a general guideline, keep assembly dependencies private and locate assemblies in the application directory unless sharing an assembly is explicitly required. In addition, you do not have to install assemblies into the global assembly cache to make them accessible to COM interop or unmanaged code.
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 (C:\Windows\assembly).
The following example installs an assembly with the file name hello.dll
into the global assembly cache. +
gacutil -i hello.dll
After .net 4.0, you should use the gacutil tool from following path:
%ProgramFiles%\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\