根据模式执行自定义操作 - WIX

发布于 2024-11-01 09:11:03 字数 703 浏览 4 评论 0原文

我们已经为我们的应用程序创建了 WIX 安装程序。我们面临的问题是: 我们定义了两个不同的自定义操作(例如 ActionForInstall 和 ActionForUninstall),我们希望在以下情况下执行它们: ActionForInstall :应在安装、产品升级、维护模式(用于修复和修改)时运行 ActionForUninstall :应该仅在卸载时运行。

但我们无法设置适当的条件。您可以参考代码:

<Custom Action=ActionForInstall After='InstallFinalize' > 
    (NOT Installed) OR (Installed AND ((MaintenanceMode = "Modify") OR (MaintenanceMode = "Repair")) AND (NOT (MaintenanceMode = "Remove"))) OR  ((UPGRADINGPRODUCTCODE) AND NOT(REMOVE ~= "ALL"))
</Custom>
<Custom Action=ActionForUninstall Before='InstallFinalize'>
    Installed AND NOT UPGRADINGPRODUCTCODE
</Custom>

请让我们知道我们做错了什么。上面的代码即使是为了卸载也会调用InstallFinalize。

We have created WIX installer for our application. Problem we are facing is:
We have defined two different custom action (say ActionForInstall and ActionForUninstall) that we want to perform in following case:
ActionForInstall : Should run while installation, product upgrade, maintenancemode (for both repair and modify)
ActionForUninstall : Should run only for uninstallation.

But we are not able to set proper condition. You can refer code :

<Custom Action=ActionForInstall After='InstallFinalize' > 
    (NOT Installed) OR (Installed AND ((MaintenanceMode = "Modify") OR (MaintenanceMode = "Repair")) AND (NOT (MaintenanceMode = "Remove"))) OR  ((UPGRADINGPRODUCTCODE) AND NOT(REMOVE ~= "ALL"))
</Custom>
<Custom Action=ActionForUninstall Before='InstallFinalize'>
    Installed AND NOT UPGRADINGPRODUCTCODE
</Custom>

Please let us know what we have done wrong. Above code is calling InstallFinalize even for uninstall.

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

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

发布评论

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

评论(2

猫卆 2024-11-08 09:11:03

您可以尝试以下条件:

ActionForInstall:

REMOVE <> "ALL"

ActionForUninstall

REMOVE = "ALL"

You can try these conditions:

ActionForInstall:

REMOVE <> "ALL"

ActionForUninstall

REMOVE = "ALL"
慕烟庭风 2024-11-08 09:11:03

通常,使用产品级属性(例如“未安装”和“REMOVE=”ALL”)的条件无法满足您的期望。通常最好使用组件操作状态,例如

$COMPONENTNAME=3 <-- 本地安装的组件

$COMPONENTNAME=2 <-- 组件之前已安装,现在正在删除

这通常会涵盖您的所有安装、卸载、维护、维修、升级场景。

您可以使用“&”对功能执行类似的操作运算符,但通常使用组件“$”更好,因为组件是物理的并且可以与仅逻辑的一个或多个特征相关联。

如果您确实想将其提升到一个新的水平,您的自定义操作可以(应该)使用与组件表的外键连接来进行数据驱动。在这种情况下,您的自定义操作始终会触发,然后查询表并评估组件操作状态来决定需要安排哪些操作。

条件语句语法 (Windows)

Usually conditions that use product level properties such as Not Installed and REMOVE="ALL" don't scale to your expectations. It's generally better to use component action states such as

$COMPONENTNAME=3 <-- component being installed locally

$COMPONENTNAME=2 <-- component was previously installed and is now being removed

This will generally cover all of your install, uninstall, maintenance, repair, upgrade scenarios.

You can do similar things for Features using the "&" operator but generally using components "$" is better as components are physical and can be associated to one or more features which are only logical.

And if you really want to take it to the next level, your custom actions could (should) be data driven using a foreign key join to the Component table. In this scenario your custom action always fires and then queries the tables and evaluates the component action states to decide which operations need to be scheduled.

Conditional Statement Syntax (Windows)

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