skip to content »

Updating the gac

updating the gac-45

By default, when you add a reference to a DLL to your project, the reference's "Copy Local" property is set to true.On building the solution, the DLL will therefore be saved into the folder containing the compiled program.

updating the gac-7updating the gac-45

There are many methods for installing an assembly into the global assembly cache.To maximise the potential for reuse, you will generally isolate a class library within an assembly, or a group of related assemblies, and package it into a dynamic linked library, or DLL.This DLL can then be referenced from within many other class libraries or software applications.The global assembly cache (GAC) provides a centralised, machine-wide storage location for . When you add an assembly to the GAC, you allow it to be shared by many programs, rather than requiring a copy to be installed for each application.The principle of code reuse, to minimise the processes of duplicating code between software applications, often leads to the creation of shared class libraries.If the shared classes are updated to fix bugs or to implement new features, the DLL may need to be deployed to multiple locations to ensure that every program is using the latest revision.

The Global Assembly Cache, or , provides a solution to the problem of duplicated DLLs.

If you are not using an installer, there are two easy ways to install an assembly to the GAC. NET Global Assembly Cache Utility (gacutil.exe) or by copying the DLL using Windows Explorer.

Although there are other ways to achieve the same results, I will describe these two variations in this article.

The use of the global assembly cache for storing your shared assemblies has some drawbacks.

One of the more important problems is that when your programs rely on assemblies being registered in the GAC, they become more difficult to deploy.

The entire output folder can then be simply copied to the end-user's computer and executed, as all of the required assemblies are available.