Tuesday, July 22, 2014

Not able to uninstall .net assembly from GAC

Occasionally when we try to uninstall .net dll from GAC by pressing delete button, it will show the below error message.
Unable to uninstall: assembly is required by one or more applications

Solution 1 - Run in admin mode

The major reason could be the user don't have permission to delete the dll from GAC. If we run the windows folder explorer in administrator mode it might be uninstalled. How to run the windows explorer as in administer mode? We cannot right click and "Run as administrator" on any item to get an explorer window in admin mode. So we need to run the cmd in admin mode. and use the GACUtil.exe to remove the dll. 

Most of the cases it will get uninstalled. Else try the below link to and uninstall as admin .

Solution 2 - Installer problem. Edit registry

There is one more reason why we cannot uninstall from GAC. Sometimes the the assembly might have installed into GAC by installers and they will hold the reference so that we cannot uninstall from GAC. If this is the case we need to remove some registry entries present inside the below registry path.


This is already reported to MSFT and more details can be found in below links.

Last week when I was trying to run a sample which I got from internet, it was loading wrong Microsoft.Practices.Unity.dll. I could see that there is one Microsoft.Practices.Unity.dll of different version in the GAC. So thought of deleting it from GAC and it ended up in the above mentioned error.

No comments: