Global Assembly Cache Article Index for
Global
Website Links For
Global
 

Information About

Global Assembly Cache




The Global Assembly Cache or '''GAC''' is a machine-wide .NET Assemblies Cache for Microsoft 's CLR platform.
Shared Assemblies: An assembly available for use by multiple applications on the computer


REASONS FOR USAGE

There are several reasons to install an Assembly into the GAC:


Shared Location

Assemblies that should be used by all applications can be put in the global assembly cache. For example, if all applications should use an assembly located in the global assembly cache, a version policy statement can be added to the Machine.config file that redirects references to the assembly.


File Security

Administrators often protect the WINNT directory using an Access Control List (ACL) to control write and execute access. Because the global assembly cache resides in the WINNT directory, it inherits that directory's ACL. It is recommended that only users with Administrator privileges be allowed to delete files from the global assembly cache.


Side-by-Side Versioning

Multiple copies of assemblies with the same name but different version information can be maintained in the global assembly cache.


Additional Search Location

The CLR checks the GAC for an assembly that matches the assembly request before probing or using the codebase information in a configuration file..


REQUIREMENTS

Assemblies residing in the GAC must adhere to a specific versioning scheme which allows for side-by-side execution of different code versions. Specifically, such assemblies must be "strong named".


USAGE

gacutil.exe is the .NET utility used to work with the GAC.

One can check the availablity of a shared assembly in GAC by using the command:
gacutil.exe /l

One can register a shared assembly in the GAC by using the command:
gacutil.exe /i


EXAMPLE OF USAGE

A computer has two .NET Assemblies both named AssemblyA, but one is version 1.0 and the other is version 2.0. Since it is required that both be compiled to a file named AssemblyA, they cannot exist in the same directory within the FAT32 filesystem. Instead, the virtual file system of the GAC can be used by applications that need to use each version of the assembly specifically.


REAL WORLD

The GAC is a convenient fiction that is implemented by the .NET Framework and aided by Windows Explorer. Actually, it is a folder within the folder %systemroot% named '''assembly'''. When viewing '''assembly''' with Windows Explorer, one sees a list of globally-available assemblies together with their individual version numbers and public key tokens. Only '''strongly named assemblies''' may be dragged and dropped into the GAC via Windows Explorer. Several versions of an identically-named assembly may co-exist in the GAC. Callers into an assembly specify which version they desire.


EXTERNAL LINKS