How do I force an assembly to uninstall from the GAC?
Solution 1
First, verify that your assembly is not locked by another process via gacutil.exe
gacutil /u WBRT.Configuration
If the above is OK make sure the file parent container has no permanent flag -
Permanent="no"
<Component Shared="yes" Permanent="no" Guid="PUT-GUID-HERE" >
<File Id="filB7155C3E9A241BEAFE09533364964732" KeyPath="yes" Assembly=".net"
Source="$(var.Configuration.TargetDir)\WBRT.Configuration.dll" />
</Component>
Solution 2
I followed the steps mentioned by @Mohsen , Remove the registry entry and uninstalled the DLL from GAC to resolve a conflict issue.
[HKLM\SOFTWARE\Classes\Installer\Assemblies\Global] and run gacutil /u dllname -And success. I do not know what is the side effect. It worked for me, then I ran
gacutil -u dllThatIWantedToRemove
Alex Angas
Updated on June 04, 2022Comments
-
Alex Angas almost 2 years
I've developed a simple installation package using WiX that installs an assembly called
WBRT.Configuration
into the Global Assembly Cache (GAC). While the file installs, it is not removed when the package is uninstalled.I've tried running a command prompt as administrator, used msiexec /x specifying the msi filename and msiexec /x specifying the product code.
With the /l*v switch, there is no error:
Executing op: ActionStart(Name=MsiUnpublishAssemblies,Description=Unpublishing assembly information,Template=Application Context:[1], Assembly Name:[2]) Executing op: AssemblyUnpublish(,,AssemblyType=1,,AssemblyName=WBRT.Configuration,version="1.0.0.0",culture="neutral",publicKeyToken="361AD75BADC53912",processorArchitecture="MSIL",Descriptor=2-(xWui~z@UnhQuo-~Gh>S.OwM9Kim9x0ul%Ore=9) Executing op: ActionStart(Name=UnpublishFeatures,Description=Unpublishing Product Features,Template=Feature: [1])
WiX File element
<File Id="filB7155C3E9A241BEAFE09533364964732" KeyPath="yes" Assembly=".net" Source="$(var.Configuration.TargetDir)\WBRT.Configuration.dll" />
MsiAssemblyName table in Orca
File in the GAC
Version tab of the file in the GAC
I'm completely stumped. Does anyone have ideas?
-
Alex Angas over 12 yearsGacutil gave the message
Unable to uninstall: assembly is required by one or more applications
. Process Explorer showed what processes were locking the DLL and ended them. The file then uninstalled correctly! -
toha almost 7 years@AlexAngas : same with me. How to unlock the dependency?
-
toha almost 7 yearsFinally I delete my dll name key at [HKLM\SOFTWARE\Classes\Installer\Assemblies\Global] and run gacutil /u dllname -> And success. I do not know what is the side effect.
-
Mohsen Sichani over 6 years@Toha, worked for me, then I ran
gacutil -u dllThatIWantedToRemove