[WEBINAR] The New Normal: Dealing with the Reality of an Unsecure World

Global Assembly Cache (GAC)

Definition - What does Global Assembly Cache (GAC) mean?

The Global Assembly Cache (GAC) is a folder in Windows directory to store the .NET assemblies that are specifically designated to be shared by all applications executed on a system.

The concept of GAC is the result of the .NET architecture whose design addresses the issue of "DLL hell" that existed in COM (Component Object Model). Unlike in COM, there is no need for the assembly in GAC to be registered before its use. Each assembly is accessed globally without any conflict by identifying its name, version, architecture, culture and public key.

Techopedia explains Global Assembly Cache (GAC)

The GAC is a machine-wide code cache used for side-by-side execution of assemblies. The GAC implements the feature of shared library where different applications reuse the code placed in the files located in a common folder. In .NET 4.0, its default location is: %windir%\Microsoft.NET\assembly

The GAC is also the first in the search path while loading a .NET assembly. The only requirement for an assembly to be deployed in GAC is that it should have strong name. The CLR (Common Language Runtime) refers an assembly based on specific version mentioned by the calling application. The virtual file system of GAC helps to fetch the version-specific assembly.

The two tools related to GAC are GAC Tool (gacutil.exe) and Assembly Cache Viewer (shfusion.dll). GAC Tool is used to check for assembly existence, register a shared assembly, view and manipulate contents of GAC, etc. Being a system folder, it requires administrator privileges to be used. Assembly Cache Viewer is used to display the details (version, culture, etc.) associated with the assemblies contained in the cache.

GAC provides the benefits of code reuse, file security (due to its installation in ‘systemroot’ directory and hence deletion is only by users with Administrator privileges), side-by-side execution (allowing multiple versions of an assembly maintained in the same folder), etc.

One of the drawbacks in using GAC are that the version of .NET Framework installed in the system where GAC is used and the one used for compiling the application need to be same. Also, strong names cannot be applied to assemblies (like third party code) on which the assemblies residing in the GAC folder depend upon.

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
"Techopedia" on Twitter

Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

Free Whitepaper: The Path to Hybrid Cloud
Free Whitepaper: The Path to Hybrid Cloud:
The Path to Hybrid Cloud: Intelligent Bursting To Amazon Web Services & Microsoft Azure
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.