在“LaunchConditions”之前在WiX中排序自定义操作

时间:2010-01-21 13:15:29

标签: wix custom-action launch-condition

是否可以在“LaunchConditions”之前对自定义操作进行排序?

这是我的自定义操作:

<CustomAction
    Id="CA_vcAppRunning"
    BinaryKey="vcShowMsg"
    DllEntry="IsAppRunning"
    Return="check"
    Execute="immediate"/>

<InstallExecuteSequence/>

中排序
<Custom Action="CA_vcAppRunning" Before="LaunchConditions" />

我尝试了这个,打开了Orca中的MSI文件,发现我的自定义操作按“99”排序。 但是当我尝试安装时,它从未被调用过。

我想在LaunchConditions之前安排这个,因为这个自定义操作应该设置一个在LaunchCondition中使用的属性(如果应用程序正在运行,退出安装程序/更新程序)。

1 个答案:

答案 0 :(得分:4)

不要在LaunchConditions之前安排它,在FindRelatedProducts之后安排它,然后根据第一个CA的结果添加第二个阻止安装的自定义操作。

这与许多教程中用于防止降级的方法相同,例如

<CustomAction Id="CA_BlockOlderVersionInstall" Error="!(loc.LaunchCondition_LaterVersion)" />
<InstallExecuteSequence>
        <LaunchConditions After="AppSearch" />
        <Custom Action="CA_BlockOlderVersionInstall" After="FindRelatedProducts">
            <![CDATA[NEWERVERSIONDETECTED]]>
        </Custom>
</InstallExecuteSequence>
<InstallUISequence>
        <LaunchConditions After="AppSearch" />
        <Custom Action="CA_BlockOlderVersionInstall" After="FindRelatedProducts">
            <![CDATA[NEWERVERSIONDETECTED]]>
        </Custom>
</InstallUISequence>