Welcome to MSDN Blogs Sign in | Join | Help

How to Copy an Assembly From the GAC to the File System

Sometimes you need a local copy of an assembly from the GAC and here is a quick tip on how to do it.  The GAC can be found in the c:\windows\assembly directory, but if you try to browse it, the following custom shell extension appears:

image

This view does not provide the ability to copy assemblies, but it does provide some very useful information such as the strong name details.  Here are some options to get around that feature to copy an assembly from the GAC.

Option 1: Disable the Shell Extension in the Registry

One possibility, but not the best one, is to disable the shell extension.  I don't like this approach because it involves editing the registry and I like the information provided by the shell extension.  Here's how to disable the extension if you want to.  Open the registry editor and add/set the HKLM\Software\Microsoft\Fusion\DisableCacheViewer DWORD value:

image

Set the value to 1:

image

Once you make that change, you can browse the directory:

image

 

Option 2: Go Command-O

Another option is to copy assemblies from the GAC from the command line.  This approach works well if you prefer working from the command line, but if you like to right-click with a mouse, this might not be the choice for you.

I highly recommend PowerShell, but you can use Windows Command Prompt.  Find your way to the c:\windows\assembly directory and copy the file you need:

image

Option 3: Use the SUBST Command

The SUBST command allows you to create a shortcut to a path on your file system and assigns that shortcut a drive letter.  I really like this approach because you have the option of using Windows Explorer without having to disable the shell.

Suppose you want to create a G Drive (G for GAC), use the following command: SUBST G: C:\WINDOWS\ASSEMBLY

image

Then in Windows Explorer you are free to double-click and right-click to your heart's content and still use the shell extension. 

image

Published Wednesday, January 14, 2009 1:20 AM by johnwpowell
Filed under: , , ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: How to Copy an Assembly From the GAC to the File System

Wednesday, January 14, 2009 6:12 AM by Przemyslaw Wlodarczak

There is also Option 4: Use good old Total Commander

# re: How to Copy an Assembly From the GAC to the File System

Wednesday, January 14, 2009 7:58 AM by Ross Beehler

Another way is to type a path beyond 'C:\windows\assembly' in the Run window.  If you're running .NET 2.0 or greater, try 'C:\windows\assembly\GAC_MSIL' and it will open up an explorer window to that folder.  Do note that this method does not work from an open explorer window, but only the Run window.

# re: How to Copy an Assembly From the GAC to the File System

Wednesday, January 14, 2009 8:24 AM by johnwpowell

Great tips!

# re: How to Copy an Assembly From the GAC to the File System

Wednesday, January 14, 2009 11:14 AM by Einar Ingebrigtsen

Great tips.

Option #X :

In the c:\Windows\Assembly directory, you'll find a hidden file called desktop.ini - remove or rename this.

From command line you can see it by going into that directory and typing "dir /a".

Then do : "attrib -h desktop.ini" and "ren desktop.ini desktop.tmp".

# Interesting Finds: 2009 01.15 ~ 01.17

Friday, January 16, 2009 10:37 PM by gOODiDEA.NET

Web Web Design Trends For 2009 Why learning CSS is important in a (web) development world - Fizzler:

# Interesting Finds: 2009 01.15 ~ 01.17

Friday, January 16, 2009 10:41 PM by gOODiDEA

WebWebDesignTrendsFor2009WhylearningCSSisimportantina(web)developmentworld-...

# re: How to Copy an Assembly From the GAC to the File System

Tuesday, February 03, 2009 6:23 AM by Benjy

I use a free tool called GACView by NirSoft, which allows you to copy out assemblies to any folder you want. Very useful tool. It also shows more columns than the default shell extension and its easier to search and filter.

HTH,

Benjy

# re: How to Copy an Assembly From the GAC to the File System

Tuesday, June 02, 2009 12:57 AM by Sandeep

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker