GAC - To add an assembly to the GAC, drag and drop works, but copy and paste doesn't? Why?

richard picture richard · Feb 24, 2011 · Viewed 15.9k times · Source

I would like to know why drag and drop works, and copy paste doesn't. What is happening with a drag and drop that isn't happening with a copy and paste?

Answer

Dan Abramov picture Dan Abramov · Feb 24, 2011

When you drag and drop your assembly into C:\windows\assembly folder, it doesn't really get copied there—a special Windows Explorer plugin callis gacutil to install your assembly into GAC.

This Explorer plugin can be confusing because it may give one an illusion that GAC is just plain simple folder with lots of DLLs. Actually, it is a hierarchical structure with a folder for each assembly name, inside of which there are folders for different versions, and so on.

If you want to see the real GAC structure, open HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion in Windows Registry and set DWORD DisableCacheViewer to 1. This will disable Cache Viewer plugin that makes GAC look so simple (but it also will make drag and drop to install unusable—you'll have to call gacutil yourself). Of course, you can use alternative file managers or console as well, if you don't want to mess with registry settings.

As for the reasons why copy-pasting does not work, I believe whoever designed Cache Viewer plugin thought that drag and drop is a good metaphor for putting something in GAC, whereas implementing copying and pasting would really make GAC seem like a normal folder—which it is not.