Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 832
richard Avatar asked Feb 24 '11 20:02

richard


People also ask

How do I copy an assembly to the GAC?

Open Windows Explorer and navigate to the %WINDIR%\Assembly folder (this is not the physical path, but is a view into the combined GACs) Copy and Paste (Drag and drop) the new DLL file into the Assembly folder.


1 Answers

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.

like image 95
Dan Abramov Avatar answered Nov 23 '22 04:11

Dan Abramov