How do I force an assembly to uninstall from the G

2019-02-28 10:45发布

问题:

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?

回答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>


回答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