当文件在使用时,从GAC WiX卸载程序集

时间:2018-03-02 13:33:24

标签: dll wix gac

使用WiX 3.11我开发了一个简单的安装文件,它在全局程序集缓存中安装了一个DLL:

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

安装正常,文件放在GAC_32文件夹中。尝试卸载程序包时,该文件当前正由另一个进程使用(例如,在Visual Studio中加载),该文件不会被卸载,并且WiX安装包不会返回任何错误:

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 

但最后一行总是显示

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

如果文件当前正在使用或由于某些其他原因无法删除,是否可能无法卸载?

0 个答案:

没有答案