How to copy an assembly from the GAC

The Windows Global Assembly Cache (GAC) is where our developers have been putting shared components for SharePoint web applications. It is a rather vague and somewhat virtual place on the hard drive, usually thought to be located at %windir%\assembly, which is somewhat true. Read on. :)

If you want to copy a file to it, you have to use Windows Explorer and drag-and-drop it into %windir%\assembly. Oddly enough, however, you can’t drag-and-drop or cut-and-paste an assembly out of the GAC in Windows Explorer. If you drop to a command line and cd %windir%\assembly then do a dir, you will not see the list of assemblies you see in Windows Explorer. Instead there are a series of folders corresponding to different assembly types, and folder inside those corresponding to different assemblies and versions thereof. So how do you get something out of the GAC anyway?

If your assembly is named mycode, drop to a command line and cd %windir%\assembly. Now do a search for it with dir mycode* /s/b/p. The result should include a line showing your file with the full path. Now you can use a regular old copy command to copy it somewhere else.

This is most certainly not the full story on the GAC, but hopefully it is enough to enable you to figure it out for your particular situation.

This entry was posted in SharePoint. Bookmark the permalink.

2 Responses to How to copy an assembly from the GAC

  1. Praveen says:

    Thanks! This was very helpful!

  2. Hammy says:

    Thank you so much. This really helpful!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s