GAC (Global Assembly Cache) is where all shared .NET assembly resides. GAC is used in the following situations: -
- If the application has to be shared among several application available in same computer.
- If the assembly has some special security, requirements like only administrators can remove the assembly. If the assembly is private then a simple delete of assembly the assembly file will remove the assembly.
One you have installed the assembly the DLL can be seen in ‘c:\windows\assembly\’ folder.
When we have many DLL’s to be deployed we need to create setup and deployment package using windows installer. So the common way of deploying GAC DLL in production is by using windows installer.
Choosing from two versions of the same assembly in GAC:
When we have two version of the same assembly in GAC we need to use binding redirect tag and specify the version we want to use in the new version property as shown in the below “app.config” file.
<assemblyIdentity name="ComputerName" publicKeyToken="cfc68d722cd6a164" />
<publisherPolicy apply="yes" />
<bindingRedirect oldVersion="188.8.131.52" newVersion="184.108.40.206" />