Add and remove an assembly from GAC

The .NET assembly serves as a compiled code library that plays a crucial role in deploying, versioning, and ensuring the security of software applications. Assemblies that reside in the Global Assembly Cache (GAC) follow a specific versioning scheme, enabling multiple versions of code to coexist and be executed side by side without conflicts. There are two primary types of assemblies: process assemblies, represented by executable files (EXE), and library assemblies, represented by dynamic-link library files (DLL).

On every computer where the .NET Framework is installed, there exists a Global Assembly Cache, which is located in the Assembly folder within the Windows directory, typically found at C:\Windows\Assembly. To manage the contents of the global assembly cache, developers can utilize the Global Assembly Cache tool (Gacutil.exe), which provides functionality to view and manipulate the assemblies stored within the GAC. This tool serves as a valuable resource for managing assembly versions, resolving dependencies, and ensuring the proper execution of .NET applications.

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)


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