3

I am trying to uninstall a DLL from the C:\Windows\Assembly "folder" on Windows Server 2008, but am getting a "permission denied" error. How do I go about removing a DLL without uninstalling the entire application?

An application vendor has sent me new DLL's, with no instructions on how to remove the old version or add these new ones. Google hasn't been as helpful as usual, either...

SamErde
  • 3,324
  • 3
  • 23
  • 42
  • I am not sure, but perhaps you need to unregister it with [regsrv32](http://support.microsoft.com/kb/249873) and register the new one? Make sure try to use that from an _elevated_ shell. – Zoredache Sep 01 '10 at 22:20
  • This was on a 64-bit server, so that didn't work, either. Using \windows\syswow64\regsvr32 c:\filename.dll may be an option. – SamErde Sep 01 '10 at 22:24
  • 1
    Using regsvr32.exe or \windows\syswow64\regsvr32.exe would be an option for most DLL's, but I don't think it can uninstall from the GAC. I have posted my solution below. – SamErde Sep 01 '10 at 22:30

3 Answers3

4

This didn't work before, but thankfully did on my last attempt. Go figure...

I found gacutil.exe on the server and ran gacutil -u dllName.DLL Installing the new DLL was simply gacutil -i "PathAndFilenameOfNewDLL"

http://msdn.microsoft.com/en-us/library/zykhfde0%28VS.80%29.aspx

SamErde
  • 3,324
  • 3
  • 23
  • 42
3

I know I'm late to the party, but here is another solution using Powershell if you do not have gacutil.exe present. Gacutil is a development tool and normally isn't present on production systems.

Fire up PowerShell using an elevated prompt by right-clicking on it and selecting "Run As Administrator." Then type or copy/paste the following:

$pathToFile = 'PathAndFilename.dll'
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacRemove($pathToFile)

If you want to install a copy to the GAC, change the last line to this:

$publish.GacInstall($pathToFile)
JamesQMurphy
  • 131
  • 4
  • A great and important solution for test systems where GacUtil is not available. Worked great for me once I realized how important the quotes around the DLL name are. – BlueMonkMN Jun 05 '15 at 21:27
1

Put gacutil /u in a cmd file and run by right clicking and selecting Run As Administrator. This worked where everything else suggested failed.

Rob
  • 11
  • 1