WIX卸载自定义操作错误代码2753

时间:2016-01-27 17:56:29

标签: wix windows-installer wix3.9

我遇到了WIX CustomAction的问题,我想在用户卸载应用程序时运行它。

这是我的XML

http://schemas.microsoft.com/wix/2006/wi'>   

<Package Description='pak' InstallerVersion='200' Compressed='yes' />

<Media Id='1' Cabinet='setup.cab' EmbedCab='yes' />

<Property Id='ARPSYSTEMCOMPONENT'>1</Property>

<Directory Id='TARGETDIR' Name='SourceDir'>
  <Directory Id="TempFolder">
    <Directory Id="INSTALLLOCATION" Name="~_tmpdir">
      <Component Id='MyComponent' DiskId='1' Guid=''>
        <File Id="File0" Name="Runtime.exe" Source="Runtime.exe" />
      </Component>
    </Directory>
  </Directory>
</Directory>


<Feature Id='InstallFeature' Title='Install Feature' Level='1'>
  <ComponentRef Id='MyComponent' />
</Feature>

<CustomAction Id="RunInstall" Return="ignore" Execute="deferred" FileKey="File0" ExeCommand="Runtime.exe" HideTarget="no" Impersonate="no" />
<CustomAction Id="RunUninstall" Return="ignore" Execute="deferred" FileKey="File0" ExeCommand="Runtime.exe" HideTarget="no" Impersonate="no" />

<InstallExecuteSequence>
  <Custom Action="RunInstall" Before="InstallFinalize">NOT REMOVE~="ALL"</Custom>
  <Custom Action="RunUninstall" Before="InstallFinalize">REMOVE~="ALL"</Custom>
</InstallExecuteSequence>

Runtime.exe在安装应用程序时按预期启动,但是当我卸载时出现错误“安装程序在安装此软件包时遇到意外错误。这可能表示此软件包有问题。错误代码为2753”。

查看事件查看器可以更轻松地解决问题,它包含以下内容“安装程序在安装此软件包时遇到意外错误。这可能表示此软件包存在问题。错误代码为2753.参数是:File0 ,,“。

所以,好像它找不到Runtime.exe,但我不知道为什么。该文件捆绑到MSI中,并在安装时运行,但我无法解决为什么它不能在卸载时运行。

非常感谢

1 个答案:

答案 0 :(得分:2)

您应该先前对卸载自定义操作进行排序。 “在InstallFinalize之前”很晚,并且几乎肯定会导致在RemoveFiles删除它之后尝试运行程序,因此出错。查看MSI文件中的InstallExecuteSequence,查看RemoveFiles与CA和InstallFinalize的相对位置。您可能需要在StopServices和其他删除注册表值的操作之前,具体取决于您的代码所需的已安装产品的数量。或者从二进制表中运行它(注意依赖关系),如果它确实需要在卸载完成之前完成。