简体   繁体   English

如何在WiX中使用After =“InstallValidate”的RemoveExistingProducts之前执行自定义操作

[英]How to execute Custom Action before RemoveExistingProducts with After=“InstallValidate” in WiX

I have something like this: 我有这样的事情:

<InstallExecuteSequence>
  <RemoveExistingProducts After="InstallValidate"/>
</InstallExecuteSequence>

Since one of the uninstallation fails i need to execute a Custom Action to solve the problem BEFORE RemoveExistingProducts. 由于其中一个卸载失败,我需要执行自定义操作以在RemoveExistingProducts之前解决问题。 Something in the lines of: 有些东西:

<CustomAction Id="FixStuff" .. />

<InstallExecuteSequence>
  <Custom Action="FixStuff" Before="RemoveExistingProducts" />
  <RemoveExistingProducts After="InstallValidate"/>
</InstallExecuteSequence>

This of course doesn't work since Custom Action cannot be before InstallInitialize. 这当然不起作用,因为自定义操作不能在InstallInitialize之前。 I'd really like to remove existing products between InstallValidate and InstallInitialize, but i'd like to execute FixStuff before removing existing products. 我真的想删除InstallValidate和InstallInitialize之间的现有产品,但我想在删除现有产品之前执行FixStuff。

Is it even possible to do that? 甚至可以这样做吗?

Unfortunately you cannot run an elevated custom action before RemoveExistingProducts with your current configuration. 遗憾的是,您无法在使用当前配置的RemoveExistingProducts之前运行提升的自定义操作。

Some possible approaches would be: 一些可能的方法是:

  1. Move RemoveExistingProducts right before InstallFinalize. 在InstallFinalize之前移动RemoveExistingProducts。 This solves the custom action problem, but other problems may occur since this approach has many restrictions (the components need to maintain their names and GUIDs between versions, your custom actions should be aware that the upgrade is performed at installation end etc.). 这解决了自定义操作问题,但是由于此方法有许多限制(组件需要在版本之间维护其名称和GUID,您的自定义操作应该知道在安装结束时执行升级等),因此可能会出现其他问题。

  2. Create an EXE bootstrapper which fixes the old installer before launching the new MSI. 创建一个EXE引导程序,在启动新的MSI之前修复旧的安装程序。 This bootrapper can require Administrator privileges through a manifest: 此引导程序可以通过清单要求管理员权限:

http://msdn.microsoft.com/en-us/library/bb756929.aspx http://msdn.microsoft.com/en-us/library/bb756929.aspx

  1. Repair the broken MSI by using this method: 使用此方法修复损坏的MSI:

    • fix the problem in the old MSI 修复旧MSI中的问题
    • create a BAT or EXE bootstrapper which recaches it through this command: 创建一个BAT或EXE引导程序,通过此命令重新访问它:

    msiexec /fv <path_to_msi> msiexec / fv <path_to_msi>

    • distribute this MSI as an update before your new package 在新软件包之前将此MSI作为更新分发

When your new package runs RemoveExistingProducts, the old cached MSI should be fixed and it should uninstall correctly. 当您的新程序包运行RemoveExistingProducts时,旧的缓存MSI应该被修复,它应该正确卸载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM