是否可以在“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中使用的属性(如果应用程序正在运行,退出安装程序/更新程序)。
答案 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>