Hi, How can i get the location of the GAC directory using C#?
Exist an entry in the Windows Registry?
UPDATE
I need the location because, i want to enumerate and analize the assemblies located in the GAC.
Bye.
Hi, How can i get the location of the GAC directory using C#?
Exist an entry in the Windows Registry?
UPDATE
I need the location because, i want to enumerate and analize the assemblies located in the GAC.
Bye.
Is it not always %windir%\assembly
?
edit:
c:\Windows>dir \windows\assembly
Volume in drive C has no label.
Volume Serial Number is C8BC-2EBD
Directory of c:\windows\assembly
08/14/2009 03:06 AM <DIR> GAC
07/28/2009 03:07 AM <DIR> GAC_32
09/08/2009 10:57 PM <DIR> GAC_MSIL
08/15/2009 07:35 PM <DIR> NativeImages_v2.0.50727_32
09/08/2009 10:57 PM <DIR> temp
09/08/2009 09:47 PM <DIR> tmp
0 File(s) 0 bytes
6 Dir(s) 4,560,822,272 bytes free
It is in the %windir%\Assembly folder.
Dan got the answer first as far as a code example though.
Let the runtime manage its assemblies and trust that they'll be there. If you need to install something use gacutil. If you need to uninstall something use gacutil. If you need to access an assembly then add a reference to it in your project. If you need to interact with the GAC on someone else's machine, do what @Dan says and use MSI and friends.
Otherwise DO NOT TOUCH THE GAC
If you want to enumerate the stuff in the GAC (e.g. writing an system administration tool) your best option is to use the fusion.dll although this requires some interop code on your side.