Sunday, March 14, 2010

Getting an Assembly From the GAC

  Windows Explorer lets you browse the Global Assembly Cache (GAC) and drop strongly-named assemblies in if you’ve the proper permissions. What you can’t do is pull things out of the GAC using Explorer. Explorer hides some abstractions of the GAC from you, preventing you from pulling assemblies out.

I had the need to validate that an assembly in the GAC was indeed the version I expected; however, once a file’s in the GAC you can’t just drag it out using Explorer. (I couldn’t rely on the Version number shown in Explorer – it’s a DLL related to some SharePoint work and the pain of dealing with versioned assemblies in SharePoint is a rant I’ll save you from. Today.)

You can get around this with a quick bit of command-line fu, though. Actually, it’s just copy, so it’s not even fu.

Using an admin account, open a command prompt and change to the %SYSTEMROOT%\assembly folder. There are a number of folders under here:

C:\Windows\assembly>dir /b
GAC
GAC_32
GAC_64
GAC_MSIL
NativeImages_v2.0.50727_32
NativeImages_v2.0.50727_64
temp
tmp

Use dir /s to find the assembly you’re looking for. (Line breaks inserted)

Read more: FrazzledDad

Posted via email from jasper22's posterous