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

Tagged as

Copying Shared Assembly from GAC

, 26 Jul 2010
Rate this:
Please Sign up or sign in to vote.
This article describes how to copy an assembly from Global Assembly Cache (GAC)

Introduction

"Computer wherein the common language runtime CLR is installed has a machine-wide code cache called the Global Assembly Cache. This Global Assembly Cache stores .NET assemblies specifically designated to be shared by several applications on that computer".

Background

I faced problem where I am using a DLL in my project but by mistake got deleted, there is no source code for it to build it again and then use it, but however the assembly installed in the GAC is available. For Ex: Consider that Scheduler.dll got deleted from your project by mistake .., but is available in the GAC. As we cannot copy the DLL from GAC, and also cannot drag and drop as we do while installing. Follow the below explanation to copy the DLL from the GAC.

Explanation

The default location of the GAC is under the <%Windir% >\assembly folder. The following screen shots displays a MS DOS Command Window wherein various commands have been executed at the prompt to copy the DLL from GAC. Go to command prompt path: C:\WINDOWS\assembly

image001.png

The DIR Command displays four separate directories which are briefly described here

image06.png

Now Inside the GAC_MSIL progressively drilling through this hierarchy of folders reveals the organization of the GAC and how it implements Side-By-Side installation Below screen shot shows the Scheduler.dll

image002.png

Within each folder for a shared assembly, there is a sub folder named using the version and public key token components of the assembly
e.g. 1.0.0.0__b12b4b980378177c shown in above screen) Within this sub folder resides the actual assembly that is installed into the GAC. DisplayName, Version, Culture and PublicKeyToken are the components that uniquely identify the assembly.

image003.png

Inside 1.0.0.0__b12b4b980378177c folder you can see Scheduler.dll

image004.png

Now you can execute the COPY command to copy the dll from GAC to local system drive.

image005.png

I hope the content presented in this document is useful.

NOTE: Additionally, using MS DOS commands to alter or delete these internal folders or contents of files therein may lead to unpredictable behavior or other serious problems that may require you to reinstall the .NET Framework on the affected machine(s). Use such commands at your own risk.

License

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

Share

About the Author

Rajesh Sajjanar
Architect MNC
India India
Rajesh Sajjanar is Technical Lead working for Enterprise Dotnet applications in Bangalore, INDIA. He holds batchelor degree in Electronics and Communication Engineering from Visvesvaraya Technological University Belgaum INDIA

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web01 | 2.8.140821.2 | Last Updated 26 Jul 2010
Article Copyright 2010 by Rajesh Sajjanar
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid