Thursday 30 December 2010

Viewing contents of the Global Assembly Cache (GAC)

Here’s a quick tip, if you view the GAC using Windows Explorer you get a nice sanitised view; the underlying folders are aggregated and the contents displayed. This can be useful for quickly finding and removing things from the GAC. However, it doesn’t show you where things really are.
The Windows Explorer view is provided by a shell extension and it is possible to disable it but you’ll lose drag and drop installation into the GAC.
To see where things are really living open a DOS prompt and navigating to the GAC directory:
The directory listing will reveal the following set of folders:
  • GAC – .NET 1.x assemblies
  • GAC_32 – .NET 2.x assemblies built for 32-bit
  • GAC_64 – .NET 2.x assemblies built for 64-bit (only of 64-bit machines)
  • GAC_MSIL – .NET 2.x assemblies that are architecture independent (32 or 64-bit)
  • NativeImages_Vx_Architecture – Each of these folders is used for storing native images of .NET assemblies that have been pre-compiled using NGen (i.e. no need for JIT). There can be a number of these folders for different .Net versions and compilation targets (e.g. 32 or 64-bit)
  • temp, tmp – Temporary folders
You can then navigate to individual folders and list the contents.
Thursday 30 December 2010