如何在使用 After="InstallValidate" 的 RemoveExistingProducts 之前执行自定义操作在 WiX 中 [英] How to execute Custom Action before RemoveExistingProducts with After="InstallValidate" in WiX

查看:25
本文介绍了如何在使用 After="InstallValidate" 的 RemoveExistingProducts 之前执行自定义操作在 WiX 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的事情:

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

由于其中一个卸载失败,我需要在 RemoveExistingProducts 之前执行自定义操作来解决问题.类似于以下内容:

Since one of the uninstallation fails i need to execute a Custom Action to solve the problem BEFORE RemoveExistingProducts. Something in the lines of:

<CustomAction Id="FixStuff" .. />

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

这当然不起作用,因为自定义操作不能在 InstallInitialize 之前.我真的很想删除 InstallValidate 和 InstallInitialize 之间的现有产品,但我想在删除现有产品之前执行 FixStuff.

This of course doesn't work since Custom Action cannot be before InstallInitialize. I'd really like to remove existing products between InstallValidate and InstallInitialize, but i'd like to execute FixStuff before removing existing products.

有可能做到吗?

推荐答案

很遗憾,您无法使用当前配置在 RemoveExistingProducts 之前运行提升的自定义操作.

Unfortunately you cannot run an elevated custom action before RemoveExistingProducts with your current configuration.

一些可能的方法是:

  1. 在 InstallFinalize 之前移动 RemoveExistingProducts.这样就解决了自定义动作的问题,但是可能会出现其他问题,因为这种方法有很多限制(组件需要在版本之间维护它们的名称和GUID,你的自定义动作应该知道升级是在安装结束等时进行的).

  1. Move RemoveExistingProducts right before InstallFinalize. 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.).

创建一个 EXE 引导程序,在启动新的 MSI 之前修复旧的安装程序.此引导程序可能需要通过清单获得管理员权限:

Create an EXE bootstrapper which fixes the old installer before launching the new MSI. This bootrapper can require Administrator privileges through a manifest:

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

  1. 使用此方法修复损坏的 MSI:

  1. Repair the broken MSI by using this method:

  • 修复旧 MSI 中的问题
  • 创建一个 BAT 或 EXE 引导程序,通过此命令重新缓存它:

msiexec/fv

msiexec /fv <path_to_msi>

  • 在您的新软件包之前分发此 MSI 作为更新

当您的新包运行 RemoveExistingProducts 时,旧的缓存 MSI 应该被修复并且应该正确卸载.

When your new package runs RemoveExistingProducts, the old cached MSI should be fixed and it should uninstall correctly.

这篇关于如何在使用 After="InstallValidate" 的 RemoveExistingProducts 之前执行自定义操作在 WiX 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆