Please explain What is Global Assembly Cache (GAC) in .net framework.
What is Global Assembly Cache (GAC) in .net framework
153212-Dec-2019
Updated on 12-Dec-2019
Home / DeveloperSection / Forums / What is Global Assembly Cache (GAC) in .net framework
Please explain What is Global Assembly Cache (GAC) in .net framework.
Nishi Tiwari
13-Dec-2019When the assembly is required to be accessed or shared by multiple applications than we need to make assembly with a strong name and keep it in GAC or assembly folder by installing it with GACUtil command. GAC is folder in a windows directory to store .Net assemblies that are designed to be shared by all application executed on a system and this can be possible only by registering the assemblies into a global assembly cache (GAC). It is already installed with .Net runtime and located in ‘windows/windowsNT’ directory.
Global Assembly Cache Tool (Gacutil.exe) allows to view and manipulate the content of Global Assembly Cache. It is located in %windir%\assembly, for example (C:\windows\assembly).
Assemblies can be installed within Global Assembly Cache in two ways:-
Windows installer
Windows installer, the Windows installation engine, is the first way to add assemblies to the global assembly cache. Windows Installer provides reference counting of assemblies in the global assembly cache and other benefits.
Global Assembly Cache Tool
We can use .Net Global Assembly Cache utility (gacutil.exe) to add the assemblies to Global Assembly Cache (GAC) and to view the content of assemblies.
Syntax for installing assembly in GAC by gacutil.exe is as follows:-
cmd
gacutil -i <assembly name>
In this command, <assembly name> is the name of the assembly to install in GAC.
The following example installs an assembly with the file name hello.dll into the global assembly cache.
cmd
gacutil -i hello.dll