Copy DLL from GAC to File System

I felt really embarrassed at work today – not that anyone found out, but it drove me nuts trying to do something simple which I had done many times in the past on Windows 2003.

Getting a DLL I needed from the GAC!!!

Now normally as a developer you should always have the source where such things came from but unfortunately I find myself in a work environment where they don’t currently have source code control systems in place or an existing development system in place. Yes I know there are lots of many variations to resolving this issue – one of them being altering a registry value to make the GAC appear like an explorer folder. But I am on an unknown production system, where nothing is clear and all I want is this one DLL for backup purposes. I was not prepared to fiddle around with the Registry on a production system – NO WAY!!! So eventually after going to various sites – I looked around and around and all I could find was text explanations without the step by step instructions. Rightly so most developers would assume this is basic stuff – which in all truth it is. So here are the steps in my own simple way without needing to fiddle with the Registry or other stuff.

  • Start a windows console session (command prompt – its accessible from the Accessories group menu).
  • type into the command prompt:-

    cd c:\windows\assembly\GAC_MSIL

  • You are now in the GAC assembly area where you will see another set of directories – one directory for each DLL with the same name of the DLL.
  • So if you are looking for a DLL named ‘MyListDefinitionProject.dll’ – you will need to go into that directory by typing in:-

    cd MyListDefinitionProject

  • Then you will see a directory that is made up of the version of your DLL, and the Public Key Token as shown below:-

GAC File Listing with Version and Public Key
 

  • Now you need to go into that directory to finally get to our DLL file:-

    cd 1.0.0.0__b8203a138a19b049

  • if you now type in:-

    dir
    you will see listed the actual DLL as shown below:-

Actual DLL Listing
 

  • You can now use the Copy command to copy the DLL file to a folder you may have setup. In the example below I use the Copy command to copy the DLL file to a directory I created called Software.

Final Copy Stage from GAC
 

  • I just typed in the follwoing:-

    copy mylistdefinitionproject.dll c:\software

Hope this saves many of you a load of stress time. It was horrible for me, as I completely forgot how I had done it in the past.

Posted in: Microsoft TechBook
:

Leave a Reply