Dateianzeige des GAC im Windows Explorer / FileView of GAC in Windows Explorer [DisableCacheViewer]

This is basically the English Version of this German article on msdn: http://msdn.microsoft.com/de-de/library/bb979071.aspx by Mathias Schiffer.

It tells you how to disable the cache viewing of the global assembly cache and this way lets you view the gac the same way you can browse the rest of the file system. This is good for finding dlls that are in possession of running processes and therefore cannot be removed from the gac.


This short article shows a little tweek that allows you to browse the Global Assembly Cache (GAC) of the .NET Frameworks in Windows Explorer like a usual folder. You thereby get a look at the physical struktur of the GAC.

Browse the Global Assembly Cache (GAC) of the .NET Frameworks in Windows Explorer (it can be found in the windows sub-directory “assembly”, i.e. typically “c:\windows\assembly“). This is how Windows Explorer shows the GAC as a list (default).

The so-called “GAC-Viewer” allows you to get a good quick overview of names, types, version numbers and details of the assemblies in the GAC.

GAC

Image 1: GAC-View in Windows Explorer

This does not have a lot to do with the reality of what the directory “assembly” contains in terms of files and folders.

To get a better look at the real structure of the GAC, you can deactivate the GAC-Viewer. Every time when the GAC is viewed via Windows Explorer the value of a registry key in the registry branch HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion, the value of the DWORD-Entry DisableCacheViewer is checked. Usually this value does not exist and this means it has a value of 0. If you create a new DWORD-Entry DisableCacheViewer in the branch with the value of 1 the GAC will not use the cacheview and therefore show you everything at once.

registry

Image 2: GAC de-mystified – this is how you do it!

TRight away you will see that the GAC actually resides in a sub-directory \assembly\GAC\. For every registered assembly there is a sub-directory with the name of the assembly. This itself contains in-turn sub-directories, that contain version number and public key of the assembly in their name. These sub-directories contain the actual assembly-file and a windows initialisationfile (INI).

To get the GAC-Viewer back to normal, all you need to do is either set the value of the DWORD DisableCacheViewer to 0 or delete it altogether.

If you want to switch between views it might be helpful to have two REG-Files which you can create with the Windows Editor and save accordingly:

Windows Registry Editor Version 5.00
// Deactivate the GAC-Viewer for Windows Explorer
// Save this as text-file with the name GacViewOff.reg

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion]
“DisableCacheViewer”=dword:00000001

Listing 1: Template for a REF-File for turning off the GAC-Viewer

Windows Registry Editor Version 5.00
// Activating the GAC-Viewer for Windows Explorer (Default)
// Save this as text-file with the name GacViewOn.reg

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion]
“DisableCacheViewer”=dword:00000000

Listing 2: Template for a REG-File for turning on the GAC-Viewer

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: