Techbubbles

GAC in .NET Framework

The Global Assembly Cache known as the GAC is to enable sharing of assemblies across several managed applications installed on a machine. All managed developers can install assemblies to the GAC and share them across applications.

When to Use the GAC

When should an assembly be installed in the GAC as opposed to assembly in application base? If you have any assembly that must be shared across multiple applications and hence centrally serviced. Shared frameworks and components typically fall under this category.

It is a machinewide repository of managed assemblies.

When shouldn’t an assembly be placed in the GAC? If you need the application to be xcopy  deployable on different machines, placing the assembly in the GAC is probably not best idea. In this case the assemblies in the GAC will also need to be moved across machines.

Binder follows the “GAC always wins” policy.

GACUtil is a tool used to install, uninstall the assemblies to and from the GAC.

This tool ship with .NET Framework SDK. In .NET Framework 4.0, the GAC went through a few changes. The GAC was split into two, one for each CLR.

The CLR version used for both .NET Framework 2.0 and .NET Framework 3.5 is CLR 2.0. There was no need in the previous two framework releases to split GAC. The problem of breaking older applications in Net Framework 4.0.

To avoid issues between CLR 2.0 and CLR 4.0 , the GAC is now split into private GAC’s for each runtime.The main change is that CLR v2.0 applications now cannot see CLR v4.0 assemblies in the GAC.

Related Posts:

%d bloggers like this: