Introduction
It is an assembly container provided by the .NET Framework especially to store assemblies shared and used by different .Net applications installed on a given computer or on a given network. It is located in a subdirectory of the root system but it can not be directly accessed except that administrator permission is given before. The GAC is accessed via the .NET configuration management console witch is represented below:
Figure 1
Assume that an assembly is simultaneously used and/or reused by more than one developer or shared by more than one application. So, it should be shared by them all. Therefore using GAC is a good alternative. It is possible to install the assembly in the GAC and give developers privileges access to the system root rather than to copy it into each development station. It is possible that the assembly cache contains more than one version of the same assembly but it is important to mention in this context that assemblies' names don't have an extension like *.dll or *.exe when are displayed within the GAC list. Only the assembly name appears without any extensions because when the common language runtime CLR looks for a targeted assembly, it can precise the corresponding assembly according to the application needs.
When an application is developed against an assembly, it depends on it, therefore it needs to locate it and exploit its services when running. First of all the common language runtime CLR, which is responsible for executing the application program, verifies if the assembly is already referenced and used, if this is not the case, it searches it, at the second plan, in the application bin directory, after that, it is checked in the global assembly cache GAC, in a final step, the CLR checks information about the targeted assembly in the configuration file, in this step the code base located in the configuration file gives information about the targeted assembly. When the assembly is not or can not be found, an error occurs. And a message like this can be found in the error list:
Figure 2
Where can one find the Global Assembly Cache:
To obtain the assemblies' list in the Global assembly cache, follow this path:
Click Start --> Configuration Panel --> Administration tools --> .Net Framework Configuration
The .NET Framework 2.0 Configuration management console is opened as bellow:
Figure 3
Expand the My Computer node within the tree just at the right and then select the assembly cache node then click view List of assemblies in the assembly cache hyperlink.
Figure 4
The assembly list is displayed as bellow:
Figure 5
How can one install an assembly in the GAC:
First of all, let us develop a simple assembly. To do that, follow those steps