How to take out the dlls from GAC ?


Once I had a need to see the contents of an out-of-the-box SharePoint assembly (which was installed in GAC) using .NET Reflector tool. Assembly was: Microsoft.SharePoint.AdministrationOperation. Unfortunately we can’t locate this assembly in the physical file system of my SharePoint server. The only way would be take this assembly from outside the GAC – but how?


clip_image002


Since, the default view of the GAC folder is read-only I can’t copy it from there directly. Then, what I did was, opened the GAC in command prompt.


Here we can see the real anatomy of GAC folder.


clip_image004


 And if we want to take that assembly, we have to go inside GAC_MSIL and the version number folder, which will be like below.


clip_image006


And then we can copy this assembly to other file location. (here I am copying it to C:\ drive)


clip_image008


That was the way I did it, but if we want to see the folder-wise structure of GAC, we can do it through by adding a registry entry. You can simply go to, HKLM\Software\Microsoft\Fusion  and create a DWORD value named “DisableCacheViewer” and set it to value 1.


After that, open another instance of windows explorer, explore to c:\windows\assembly now and you see magic there. If you set the value of that DWORD value to 0 then you can switch back to the read-only view.


Please see the below screen shot to know how it will look like.


clip_image010


Comments (5)

  1. Ketaanh Shah says:

    Hey Buddy,

    instead of modifying the registry you can use the following command from the cmd prmpt:

    SUBST G: C:WindowsAssembly

    and map the GAC to G: drive and then open any assembly using the .Net Reflector.

    Regards

  2. sowmyancs says:

    Thanks Ketan. Also we can retrieve the GAC dlls using the UNC path like this.

    \MachineNamec$WINDOWSassemblyGAC_MSIL

    I think this is the most easiest way.

    So now we have 3 ways of getting the dlls from GAC :)

  3. Ketaanh Shah says:

    Ok let me add fourth one :)

    Enter %systemroot%assemblygac_msil in the Run dialog box under the start menu and you should see the folder now (of-course this one is temporary one)

  4. Anjali Ch- MSFT says:

    perfect …good ways to get the assembly from GAC. Thanks