Information Technology Reference
In-Depth Information
Shared Assemblies and the GAC
Private assemblies are very useful, but sometimes you will want to put a DLL in a central place
so that a single copy can be shared by other assemblies on the system. .NET has such a reposi-
tory, called the global assembly cache (GAC). An assembly placed into the GAC is called a shared
assembly .
Some important facts about the GAC are the following:
￿
Only strongly named assemblies can be added to the GAC.
Although earlier versions of the GAC accepted only files with the .dll extension, you can
now add assemblies with the .exe extension as well.
￿
The GAC is located in a subdirectory named Assembly , of the Windows system directory.
￿
Installing Assemblies into the GAC
When you attempt to install an assembly into the GAC, the security components of the CLR
must first verify that the digital signature on the assembly is valid. If there is no digital signa-
ture, or if it is invalid, the system will not install the assembly into the GAC.
This is a one-time check, however. After an assembly is in the GAC, no further checks are
required when it is referenced by a running program.
The gacutil.exe command-line utility allows you to add and delete assemblies from the
GAC, and to list the assemblies it contains. The three most useful flags are the following:
￿ /i : Inserts an assembly into the GAC
￿ /u : Uninstalls an assembly from the GAC
￿ /l : Lists the assemblies in the GAC
Search WWH ::




Custom Search