Recover DLL from GAC

Tuesday, 24 March 2009 20:14 by myro
Let's say you have lost your project's source code, and you have your project compiled and deployed in your GAC. That'a a bad situation... right? What can you do if you want to recover it?
The first thing you need is to retrive you DLL and then disassemble it:
Open cmd, and move to C:\WINDOWS\ASSEMBLY\

C:\WINDOWS\assembly>dir /p

 Volume in drive C has no label.

 Volume Serial Number is 7875-6475

 

 Directory of C:\WINDOWS\assembly

 

29/03/2008  16.21    DIR          GAC

26/04/2008  20.05    DIR          GAC_32

04/05/2008  22.53    DIR          GAC_MSIL

28/03/2008  04.59    DIR          NativeImages1_v1.1.4322

29/03/2008  20.24    DIR          NativeImages_v2.0.50727_32

04/05/2008  22.53    DIR          temp

04/05/2008  22.47    DIR          tmp

              0 File(s)              0 bytes

              7 Dir(s)  25.301.377.024 bytes free

 

C:\WINDOWS\assembly>

As you can see, you can access to all your .NET dll, moving to GAC_MSIL folder. Locate your DLL (you see it as a folder), and export it in this way:

C:\WINDOWS\assembly\GAC_MSIL>cd Microsoft.SharePoint

 

C:\WINDOWS\assembly\GAC_MSIL\Microsoft.SharePoint>dir

 Volume in drive C has no label.

 Volume Serial Number is 7875-6475

 

 Directory of C:\WINDOWS\assembly\GAC_MSIL\Microsoft.SharePoint

 

26/04/2008  20.04    DIR          .

26/04/2008  20.04    DIR          ..

26/04/2008  20.03    DIR          12.0.0.0__71e9bce111e9429c

              0 File(s)              0 bytes

              3 Dir(s)  25.300.611.072 bytes free

 

C:\WINDOWS\assembly\GAC_MSIL\Microsoft.SharePoint>copy 12.0.0.0__71e9bce111e9429c c:\tmp

12.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.dll

        1 file(s) copied.

 

C:\WINDOWS\assembly\GAC_MSIL\Microsoft.SharePoint>

In this example i have copied the Microsoft.SharePoint DLL to my c:\tmp folder. Now using Reflector you can easly disassembly it.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:  
Categories:   Developer Life
Actions:   Bookmark and Share | Permalink | Comments (2) | Comment RSSRSS comment feed
If you consider this post usefull for your purposes, please consider visiting my sponsors to help me out with the myrocode.com maintenance. Thank you.

Comments