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

发布于 2024-10-09 02:01:33 字数 606 浏览 0 评论 0原文

我有这样的事情:

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

由于其中一个卸载失败,我需要在删除现有产品之前执行自定义操作来解决问题。 这当然行不通,

<CustomAction Id="FixStuff" .. />

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

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

有可能这样做吗?

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. 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. I'd really like to remove existing products between InstallValidate and InstallInitialize, but i'd like to execute FixStuff before removing existing products.

Is it even possible to do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浊酒尽余欢 2024-10-16 02:01:33

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

一些可能的方法是:

  1. 将RemoveExistingProducts 移至InstallFinalize 之前。这解决了自定义操作问题,但可能会出现其他问题,因为这种方法有很多限制(组件需要在版本之间维护其名称和 GUID,您的自定义操作应该知道升级是在安装结束时执行的等)。< /p>

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

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

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

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

    msiexec /fv

    • 在发布新软件包之前将此 MSI 作为更新分发

当您的新软件包运行 RemoveExistingProducts 时,应修复旧的缓存 MSI,并且应正确卸载。

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

Some possible approaches would be:

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

  2. 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. Repair the broken MSI by using this method:

    • fix the problem in the old MSI
    • create a BAT or EXE bootstrapper which recaches it through this command:

    msiexec /fv <path_to_msi>

    • distribute this MSI as an update before your new package

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文