如何根据条件运行自定义操作? [英] How to run custom action based on condition?

查看:71
本文介绍了如何根据条件运行自定义操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试基于Windows版本运行自定义操作(删除某个文件)。
我知道如何检查Windows版本:

I'm trying to run a custom action (delete a certain file) based on the windows version. I know how to check for the windows version:

<Condition Message="Windows version xxx required...">
    <![CDATA[Installed OR (VersionNT >= 600)]]>
</Condition>

但是,我不想显示一条消息,而是删除一个文件。我找不到如何使用这样的条件来运行或不运行自定义操作的示例!

However, I do not want to display a message, but delete a file. I can't find an example on how to use such a condition to run oder not to run a custom action!

推荐答案

您需要在自定义元素,它将运行您的自定义操作。 (这使您可以在序列中的不同位置多次运行自定义操作,并根据需要在不同的条件下每次运行)。

You need to specify the condition inside the Custom element which runs your custom action. (This allows you to run the custom action multiple times in different locations in your sequence and with different conditions each time if desired).

示例:

<InstallExecuteSequence>
  <Custom Action="CreateRegistryEntries" After="CostInitialize">
    NOT Installed AND NOT PATCH
  </Custom>
</InstallExecuteSequence>

这篇关于如何根据条件运行自定义操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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