tags:

views:

300

answers:

2

I want to use the Publish.GacRemove function to remove an assembly from GAC. However, I don't understand what path I should pass as an argument.

Should it be a path to the original DLL (what if I removed it after installing it in the GAC?) or the path to the assembly in the GAC?

UPDATE:

I finally used these API wrappers.

+1  A: 

I am not exactly sure about it but I believe GacRemove should do the same thing as gacutil /u. So, it should be the path of your DLL. However it doesn't have to be the same DLL file. Copy of the original should suffice since what counts is the uniqueID of the DLL.

hakan
Does the uniqueID change with every compilation/version?
Marek Grzenkowicz
+1  A: 

I am using the GacInstall to publish my assemblies, however once installed into the gac, I sometimes delete my ‘temporary’ copy of the assemblies.

And then, if I ever wanted to uninstall the assemblies from the gac I do not have the files at the original path. This is causing a problem since I cannot seem to get the GacRemove method to uninstall the assemblies unless I keep the original files.

Conclusion: Yes, you need to specify the path to the original DLL. (And try to not move/delete it later). If you delete it, try to copy the file from the GAC to your original path and you should be able to uninstall it using GacRemove.

Espo
So I need exactly the same DLL (same version? same build?), right?
Marek Grzenkowicz
Yes, you need the same DLL, but you can copy it FROM the GAC to your original path and it should get removed. with gacremove
Espo