Thursday, October 27, 2011

Delete DLL failed due to "required by other applications" Error

Sometimes, when we try to delete a DLL, it fails due to "required by other applications" error.

Normally, we can delete a DLL from GAC by gacutil.exe tool shipped with .NET 1.1, or use the newer interface, the Assembly Cache Viewer,  integrated into Windows Explorer, located at %windir%\assembly.

For the assembly initially is installed using msi package, try to use the setup msi to uninstall the DLL.

For msi installed assembly, as the last resort, back up following registry key HKLM\Software\Classes\Installer\Assemblies\Global\. Delete the corresponding entry for the pinned DLL. (for per-machine installations, use HKCU\SOFTWARE\Classes\Installer\Assemblies\Global). Then go back to the GAC to delete the DLL.