Global assembly cache

from Wikipedia, the free encyclopedia

The Global Assembly Cache ( GAC ; German  " Global Assembly cache " ) is a method of .NET framework to version conflicts between libraries to be avoided.

Identity and installation in the GAC

The identity of Assembly is made up of five components: the name , the file version , the language version , the public key token and the processor architecture for which the Assembly translated was. The identity of the assembly is secured by what is known as a "strong name". The name is protected by signing the assembly with a public key . It is possible to install an assembly multiple times in the GAC by signing it with different keys. Thus, for. For example, a software manufacturer can change ( patch ) an open source library and sign it with its own keys. This assembly can then be installed next to the original assembly in the GAC despite the same name and version number. Localized versions such as B. for German or French (DE, FR) are just as much a part of the assembly's identity as the optimization on a processor platform ( CIL (MSIL) , x86, x64).

The GAC thus enables the system-wide provision of assemblies without having to accept naming conflicts between the underlying files ( DLLs or EXEs ). The so-called " DLL Hell " was consequently bypassed by the introduction of the GAC.

The files are usually installed in the GAC using the Windows Installer , but can also be done manually using the GACUTIL.exe program . Write access to the GAC directories is only possible with administrator rights , so that administrator rights are required to install files in the GAC.

Implementation of the GAC under Windows

View of the GAC in the explorer extension and in the actual file system

File system

Up to .NET Version 2.0, the jointly used assemblies are installed and managed in a special directory ( %SystemRoot%\assembly). The directory is %SystemRoot%\Microsoft.NET\assemblyused from .NET version 3.0 . This contains further subdirectories for the respective processor architecture (e.g. GAC , GAC_32 , GAC_64 , GAC_MSIL ) and the actual assembly names. The directories with the assembly names contain subdirectories with the assembly version and the public key. Access to the appropriate assembly version is therefore possible via a directory tree.

Explorer extension

The Windows Explorer has a special interface for displaying Assemblies, the Assembly Cache Viewer . When navigating to the %SystemRoot%\assemblydirectory, all installed assemblies are shown to the user with version, culture, key token and processor architecture. The interface also allows installation via drag and drop . However, this interface only works up to .NET version 2.0.

Web links