Sunday, July 10, 2005

How to view the 'real' GAC in Windows Explorer

UPDATE: I have received a number of comments on this post since it was published. I apparently enumerated one of the most roundabout ways of configuring your system to browse the GAC like a directory. Here are two much simpler ways of getting the same behavior:

Using the registry:

  1. Open Regedit, browse to HKLM\Software\Microsoft\Fusion.
  2. Add a REG_DWORD value named 'DisableCacheViewer'; set it to 1.

However, this comment from Carlos Mora was my favorite, it optimized my original post to approximately 30 characters (I've made this into a shortcut which I keep on my Desktop).

Start->Run->%systemroot%\assembly\GAC

I've kept the original post here in it's original form for posterity.

The Original Post:
If you want to be able to use explorer to browse to the GAC like any other directory on your system you need to disable the explorer shell extension that causes explorer to display the GAC like the picture to the left.



Here’s how to do it:

[1] Open a DOS prompt, browse to C:\windows\assembly. In Windows 2000, this is a little harder. You first need to browse to C:\winnt and run an attrib -s assembly prior to browsing to the directory. Remember to run an attrib +s assembly when you're done!

[2] Type dir /ah and hit Enter (you need the ‘/ah’ to select files with the hidden attribute set)

[3] Verify that you see a ‘desktop.ini’ file (outlined in red below):




[4] Either rename the file or open it and comment out every line by putting semicolons at the start of each line. If you choose to rename it you need to use a CMD replacement like 4nt to do so as CMD's REN command does not allow you rename hidden files! Use ren /a:h desktop.ini _desktop.ini in 4nt… If you're using CMD, you need to use the following command line in order to edit the file: attrib -s -r desktop.ini. If you really want a blast from the past, now type edit desktop.ini and relive the old DOS days in all their greatness.

A little editorial... 4NT is an amazing product, written by a company named JPSoft which used to be based in Boston's Jamaica Plain neighborhood, then in my home town of Arlington, MA. They've moved down south (I believe to North Carolina), and I'm sorry they aren't local anymore. I always was hoping to run into one of their developers at the Capitol Theatre or at Town Day and tell them how much easier they have made my job. Best of luck, guys.

All right, back to the GAC. Here's a sample of what the file will look like with everything commented out:

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

[5] If you edited the file, save it.

[6] browse to c:\windows\assembly in explorer to see the change:



You can now treat the GAC like any other directory on your system.

Thanks to my friend Cappy for these instructions.

No comments: