防止在补丁期间运行自定义操作

防止在补丁期间运行自定义操作

本文介绍了防止在补丁期间运行自定义操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为一个非常大的软件包编写一个非常小的补丁,它的唯一目的是更新单个文件并添加四个较小的文件.

I am authoring a very small patch to a very large package, it's sole purpose is to update a single file and add four smaller ones.

使用 WiX 帮助作为指导,我能够生成 MSP 文件.

Using the WiX help as a guide I am able to generate the MSP file.

然而,一个补丁显然运行,它在重新安装模式下运行原始包,所有自定义操作等等,这不是我想要的.

However, a patch runs apparently it runs the original package in reinstall mode, with all the custom actions and whatnot that go along with it, which is not what I want.

进一步研究发现了 MsiPatchMetadata 表的 OptimizeCA 属性,以及它的 WiX 等效 OptimizeCustomActions,它允许在应用补丁时跳过自定义操作.

Further research turned up the OptimizeCA property of the MsiPatchMetadata table, and its WiX equivalent OptimizeCustomActions which allows custom actions to be skipped when applying a patch.

这听起来正是我想要的,但不幸的是它没有按预期工作.原始包有一堆 XML 配置文件更改自定义操作,查看日志似乎在遇到 XmlFile CA 时出错:

That sounded exactly what I wanted but unfortunately it did not work as expected. The original package has a bunch of XML config file change custom actions, and looking at the log it appears to be erroring out when it hits the XmlFile CAs:

MSI (s) (58!74) [14:53:24:928]: PROPERTY CHANGE: Adding ExecXmlFileRollback property. Its value is (stuff deleted)
MSI (s) (58:74) [14:53:24:928]: Doing action: ExecXmlFileRollback
Action 14:53:24: ExecXmlFileRollback.
Action start 14:53:24: ExecXmlFileRollback.
MSI (s) (58:74) [14:53:24:928]: Skipping Action: ExecXmlFileRollback. It is being skipped as per the value provided for OptimizeCA in MsiPatchMetadata table of an applicable patch
Action ended 14:53:24: ExecXmlFileRollback. Return value 0.
SchedXmlFile:  Error 0x8007065a: Failed MsiDoAction on deferred action
SchedXmlFile:  Error 0x8007065a: failed to schedule ExecXmlFileRollback for file: (file)
SchedXmlFile:  Error 0x8007065a: failed to begin file change for file: (file)
Action ended 14:53:24: SchedXmlFile. Return value 3.

您可以看到 ExecXmlFileRollback 操作正在考虑 OptimizeCA 属性,因为它被跳过,但是当它尝试安排它时出现问题,导致整个事情崩溃安装程序.

You can see that the OptimizeCA property is being respected for the ExecXmlFileRollback action, as it is being skipped, but something goes wrong when it tries to schedule it and that causes the whole thing to crash the installer.

这是我编写 WiX 补丁的相关部分:

This is the relevant part of my WiX patch authoring:

<OptimizeCustomActions
  SkipAssignment="no"
  SkipImmediate="no"
  SkipDeferred="yes">
</OptimizeCustomActions>

我真的很难弄清楚接下来要尝试什么.我在 wix-users 上发现另一个人和我有完全相同的问题,但没有对查询做出回应.

I'm really having a hard time figuring out what to try next. I found another person having the exact same issue as me on wix-users but there was no response to the query.

推荐答案

包括Not PATCH"在内的条件应该会阻止 CA 在补丁安装期间运行.

A condition including "Not PATCH" should prevent the CA from running during patch install.

或者,如果产品已安装,未安装"会阻止它运行,因为您在修复过程中似乎会遇到类似的问题.

Alternatively, "Not Installed" would prevent it from running if the product is already installed, because it looks like you'd have a similar issue during a repair.

这篇关于防止在补丁期间运行自定义操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 15:34