How to retrieve a DLL from the GAC

by Louis-Philippe 29. April 2009 23:52

Sometime we have some question that we don’t get the answer right away. This one was one of them. I often ask myself “How to get a DLL from the GAC?”, and i didn’t really search for the answer because i was able to retrieve the DLL from another location.

Recently, i had the same question once again but i wasn’t able to find the assembly anywhere else. So i finally got the answer from my college Dominic Sévigny. The trick it’s that we cannot export a DLL from the GAC from the Windows interface. So we need to do it from the DOS console. Here is the procedure to do it:

First you need to open a new command window. You need to browse to the GAC_MSIL folder (c:\Windows\assembly\GAC_MSIL)

image

Each assembly have it own folder. So if you need to access the assembly “CrystalDecisions.ReportAppServer.ClientDoc” you can do it by accessing the folder.

C:\Windows\assembly\GAC_MSIL>cd CrystalDecisions.ReportAppServer.ClientDoc

Once in the folder, you should see a subfolder for each version of the assembly in the GAC.

C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.ClientDoc>dir
Volume in drive C has no label.
Volume Serial Number is C470-AE11

Directory of C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.ClientDoc

23/04/2009  09:55 PM    <DIR>          .
23/04/2009  09:55 PM    <DIR>          ..
23/04/2009  09:55 PM    <DIR>          10.5.3700.0__692fbea5521e1304
               0 File(s)              0 bytes
               3 Dir(s)  38,585,462,784 bytes free

Select the version you need by accessing the folder.

C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.ClientDoc>cd 10.5.3700.0__692fbea5521e1304

C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.ClientDoc\
10.5.3700.0__692fbea5521e1304>dir
Volume in drive C has no label.
Volume Serial Number is C470-AE11

Directory of C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.ClientDoc\
10.5.3700.0__692fbea5521e1304

23/04/2009  09:55 PM    <DIR>          .
23/04/2009  09:55 PM    <DIR>          ..
23/04/2009  09:55 PM            57,344 CrystalDecisions.ReportAppServer.ClientDoc.dll
               1 File(s)         57,344 bytes
               2 Dir(s)  38,585,479,168 bytes free

 

Now you have access to the DLL of the assembly you need. So you can copy the DLL, using Copy or XCopy, to the location you want 

image

This is why i love my job i always learn new stuff everyday, even it’s something very simple!!

Regards,
Louis-Philippe

Tags:

Comments

6/9/2010 12:45:55 PM #

anirudhya sanyal

very very helpful

anirudhya sanyal India | Reply

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



About the author

Louis-Philippe Pinsonneault is a senior .NET developer and trainer at Runatserver Consulting. He has over 9 years of experience with . NET technology. He is a certified Microsoft Certified Professional Developer (MCPD) and a Microsoft Certified Technology Specialist .NET Framework 3.5 ASP.NET Application. He also teaches ASP.NET at Technologia, Montréal.

Microsoft Certified Professional Developer

Microsoft Certified Technology Specialist

View Louis-Philippe's profile on LinkedIn

Page List