Global Assembly Cache or GAC

…is a machine-wide .NET assemblies cache for Microsoft‘s CLR platform. The approach of having a specially controlled central repository addresses the shared library concept and helps to avoid pitfalls of other solutions that lead to drawbacks like DLL hell.

Assemblies residing in the GAC must adhere to a specific versioning scheme which allows for side-by-side execution of different code versions.

 

Viewing the structure of the GAC folder in Windows Explorer:

start > run > cmd
type : "cdwindowsassembly"
type: "attrib -r -h -s desktop.ini"
type: "ren desktop.ini desktop.bak"
now open the GAC folder normally in your explorer, and you can see the actual structure.

C:Windowsassembly>dir
Directory of C:Windowsassembly

07/14/2009  10:12 AM               227 desktop.bak
01/08/2010  09:30 PM    <DIR>          GAC
03/16/2011  11:40 AM    <DIR>          GAC_32
03/16/2011  11:40 AM    <DIR>          GAC_MSIL
01/07/2010  09:48 PM    <DIR>          NativeImages1_v1.1.4322
05/03/2011  01:14 PM    <DIR>          NativeImages_v2.0.50727_32
05/03/2011  10:12 AM    <DIR>          NativeImages_v4.0.30319_32
05/03/2011  11:14 AM    <DIR>          temp
05/03/2011  09:47 AM    <DIR>          tmp
               1 File(s)            227 bytes
               8 Dir(s) 

C:Windowsassembly>

image

 

To revert your changes, do below

start > run > cmd
type : "cdwindowsassembly"
type: "ren desktop.bak desktop.ini"

type: "attrib +r +h +s desktop.ini"
now open the GAC folder normally in your explorer, and you can see the restored assemblies structure

image

Below are the contents of desktop.ini file

C:Windowsassembly>cat desktop.ini
; ==++==
;
;   Copyright (c) Microsoft Corporation.  All rights reserved.
;
; ==–==
[.ShellClassInfo]
CLSID={1D2680C9-0E2A-469d-B787-065558BC7D43}
ConfirmFileOp=1
InfoTip=Contains application stability information.

C:Windowsassembly>

 

You can also use other tools for a better processed view of GAC Assemblies and their content:

  1. Global Assembly Cache Tool (Gacutil.exe)
  2. Assembly Cache Viewer (Shfusion.dll)
  3. Assembly Registration Tool (Regasm.exe)
    GAC Registry:

All the registered assemblies will be shown up in below path:

C:>reg query "HKEY_CLASSES_ROOTInstallerAssemblies" | tail -5
HKEY_CLASSES_ROOTInstallerAssembliesc:|Windows|Microsoft.NET|Framework|v3.5|Microsoft.Data.Entity.Build.Tasks.dll
HKEY_CLASSES_ROOTInstallerAssembliesc:|Windows|Microsoft.NET|Framework|v3.5|Microsoft.VisualC.STLCLR.dll
HKEY_CLASSES_ROOTInstallerAssembliesc:|Windows|Microsoft.NET|Framework|v3.5|MSBuild.exe
HKEY_CLASSES_ROOTInstallerAssembliesc:|Windows|Microsoft.NET|Framework|v3.5|Sentinel.v3.5Client.dll
HKEY_CLASSES_ROOTInstallerAssembliesGlobal

C:>

The Global Assemblies are registered here:

C:>reg query "HKEY_CLASSES_ROOTInstallerAssembliesGlobal" | tail -3
    Microsoft.Office.Interop.PowerPoint,fileVersion="12.0.6501.5000",version="12.0.0.0000000",culture="neutral",publicKeyToken="71E9BCE111E9429C"    REG_MULTI_SZ    vUpAV5!!!!!!!!!
MKKSkPowerPoint_PIA>j]yX$iD=8@4QSF+TI1~=
    Policy.11.0.Microsoft.Office.Interop.PowerPoint,fileVersion="12.0.6425.1000",version="12.0.0.0000000",culture="neutral",publicKeyToken="71E9BCE111E9429C"    REG_MULTI_SZ    vUp
AV5!!!!!!!!!MKKSkPowerPoint_PIA>()CZN^m$Z8doer0%2zbC

C:>

      References:

    A further detailed article available on this topic is here: Demystifying the .NET Global Assembly Cache

    Leave a Reply

    Your email address will not be published. Required fields are marked *