WiX uninstall assembly from GAC when file in use

0

Using WiX 3.11 I've developed a simple installation file which installs one DLL in the global assembly cache:

<Directory Id="TARGETDIR" Name="SourceDir">
  <Component Id="CMP_ABC" 
             Guid="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" 
             Permanent="no"
             Shared="yes" >
    <File Id="File_ABC" 
          Assembly=".net" 
          Source="ABC.dll" 
          KeyPath="yes" 
          Vital="yes"/>
  </Component>
</Directory>

Installation works and the file is placed in the GAC_32 folder. When trying to uninstall the package and the file is currently in use by a different process (loaded in Visual Studio for example), the file does not get uninstalled and the WiX installation package does not return any error:

MSI (s) (68:EC) [09:24:58:210]: MsiProvideAssembly is returning: 1607
MSI (s) (68:EC) [09:24:58:429]: Assembly Error:The process cannot access the file because it is being used by another process.

MSI (s) (68:EC) [09:24:58:429]: Note: 1: 1935 2: {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} 3: 0x80070020 4: IAssemblyCache 5: UninstallAssembly 6: ABC,version="X.YY.ZZ.0",culture="neutral",publicKeyToken="XXXXXXXXXXXXXXXX",processorArchitecture="x86"
MSI (s) (68:EC) [09:24:58:429]: Note: 1: 2205 2:  3: Error
MSI (s) (68:EC) [09:24:58:429]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1935 

The last line however always shows

MSI (c) (30:88) [09:24:59:505]: Product: ABC -- Configuration completed successfully.

Is it possible to fail the uninstallation if the file is currently in use or for some other reason cannot be removed?

dll
wix
gac
asked on Stack Overflow Mar 2, 2018 by Nick

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0