Add and remove an assembly from GAC

.Net Assembly

The .Net assembly is a compiled code library used for deployment, versioning, and security. Assemblies residing in the Global Assembly Cache must adhere to a specific versioning scheme which allows for side by side execution of different code versions. There are two types of assembly, process assemblies (EXE) and library assemblies (DLL).

Each computer that .Net Framework is installed has a Global Assembly Cache, which is located in the Assembly folder in the Windows directory, normally C:\WinNT\Assembly. The Global Assembly Cache tool(Gacutil.exe) allows you to view and manipulate the contents of the global assembly cache.

How to Add an assembly to GAC ?

We can install an assembly into the global assembly cache (GAC) in two ways :

We can use Gacutil.exe to add strong-named assemblies to the global assembly cache.

Type the following at the command prompt.

gacutil -i AssemblyName

AssemblyName name is the name of the assembly to install in the global assembly cache.

We can use another option to install assembly in GAC by using Microsoft Windows Installer. This is the recommended and most common way to add assemblies to the global assembly cache.

How to remove an Assembly from GAC ?

At the command prompt type the following to remove the Assembly from GAC.

gacutil /u AssemblyName (Fully Qualified Name of Assembly)

e.g.

gacutil /u "assemblyname,Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789ABCDEF"