Click here to Skip to main content
Click here to Skip to main content

Extract GAC Assemblies

By , 6 Jan 2007
 

Sample Image - Extract_GAC_Assemblies.jpg

Introduction

Well, today I am going to write a simple but useful utility program that can be used to extract the .NET assemblies from the Global Assembly Cache.

Background

Couple of days ago, I was working with the SharePoint object model and I found that I need to extract some assemblies that are installed in the GAC of my machine. And there was no ready-made tool to do that task. That's why I thought of writing one and posting it here so that next time, it would be easier to do this for me as well as for other developers.

Using the code

I guess most of the readers know the structure of the GAC. But I am explaining it again briefly here. After installation, .NET assemblies remain in the $(windir)\assembly\GAC directory which can be found in the Windows directory (this is the usual scenario). And inside this directory, an assembly is stored under a directory which has a name similar to that of the assembly. Inside this directory there is another directory which is named XXXXX__YYYYY and underneath this directory the actual assembly is stored. Here XXXXX is the version number of the assembly and YYYYY is the public key token. This is because you know that .NET eliminates the "DLLHELL" with its elegant side by side execution. So another assembly that has the same name but a different version can be stored in the GAC without any ambiguity.

Well, inside the code I am just exploring the $(windir)\assembly\ directory programmatically. You cannot explore this directory using Windows explorer. The only way to see the real content of this directory is by using the command shell.

There is nothing more to say here. The code is pretty simple. It simply explores that directory and provides some functionality to extract/install one or more assemblies from/to the Global Assembly Cache.

Conclusion

I hope you will enjoy this!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Moim Hossain
Software Developer (Senior) BlueCielo ECM Solutions
Netherlands Netherlands
Member
Jack of all trades....Hmm...(nope not saying the rest)

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 5memberradumi7 Mar '11 - 18:26 
Great, solved my problem!
GeneralJust Two lines of code is needmemberdkumbhar9 Jun '10 - 10:44 
Open the Command Prompt and Type :
 

cd c:\windows\assembly\GAC_MSIL
 
xcopy . C:\GacDump /s /y
 

This should give the dump of the entire GAC
 
Enjoy!
 
Deepak_k
GeneralNice codesmemberMember 427330727 Mar '09 - 21:56 
Thanks
From Viet Nam
GeneralRe: Nice codesmemberMoim Hossain27 Mar '09 - 21:57 
Thanks
 
Moim Hossain
R&D Project Manager
BlueCielo ECM Solutions BV

GeneralYet another way of Exploring GAC in Windows ExplorermemberJimmyRopes8 Oct '08 - 12:23 
There is a way to explore the GAC in Windows Explorer.
 
In Windows Explorer right click on MyNetworkPlaces and select Map Network Drive...
 
Map the GAC as a network drive. \\<server name>\c$\windows\assembly
 

You can use this network drive to explore the GAC. You will find the SharePoint components you have loaded in subdirectories of GAC_MSIL.
 


Simply Elegant Designs JimmyRopes Designs
Think inside the box! ProActive Secure Systems

I'm on-line therefore I am.
JimmyRopes


General"Extract GAC Assemblies"...ThanksmemberxCOOPERx2 Oct '07 - 23:01 
Thanks! Very useful for me...
Best wishes from Sochi !

GeneralRe: "Extract GAC Assemblies"...ThanksmemberMoim Hossain3 Oct '07 - 1:40 
xCOOPERx wrote:
Thanks! Very useful for me...
Best wishes from Sochi !

 
Its a pleasure knowing that it helped you. thanks too
 
Moim Hossain
Sr. Software Engineer
Onirban Orion Technologies.

GeneralTHANKYOUmembervijaynats7 Jul '07 - 7:23 
Many thanks for making this util. This has saved me lots of time.
GeneralRe: THANKYOUmemberMoim Hossain7 Jul '07 - 18:06 
you are most welcome!
 
Moim Hossain
Sr. Software Engineer
Onirban Orion Technologies.

Generalanother waymemberEffun Din12 Mar '07 - 14:17 
I use Total Commander instead of Windows Explorer, it can browse physical files on disk directly.
GeneralRe: another waymemberMoim Hossain3 Oct '07 - 1:41 
Effun Din wrote:
I use Total Commander instead of Windows Explorer, it can browse physical files on disk directly.

 
Thats also good..I admitSmile | :)
 
Moim Hossain
Sr. Software Engineer
Onirban Orion Technologies.

GeneralJust use SUBST commandmemberstevenmcohn8 Jan '07 - 8:22 
From four years ago... http://weblogs.asp.net/jkey/archive/2003/02/25/3006.aspx
 
Sniff | :^)
 
\Steven
GeneralRe: Just use SUBST commandmemberMoim Hossain8 Jan '07 - 20:12 
Smile | :) Yeah..thats also very fancy solution. I liked it.
 
Moim Hossain
Sr. Software Engineer
Onirban Orion Technologies.

GeneralThanksmemberUsman Shaheen6 Jan '07 - 22:27 
Thanks for the nice utility
GeneralRe: ThanksmemberMoim Hossain7 Jan '07 - 3:50 
Thanks. Smile | :)

 
Moim Hossain
Sr. Software Engineer
Onirban Orion Technologies.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 6 Jan 2007
Article Copyright 2007 by Moim Hossain
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid