【问题标题】:Sequencing a custom action in WiX before "LaunchConditions"在“LaunchConditions”之前对 WiX 中的自定义操作进行排序
【发布时间】:2011-01-07 17:46:29
【问题描述】:

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

这是我的自定义操作:

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

排序在&lt;InstallExecuteSequence/&gt;

<Custom Action="CA_vcAppRunning" Before="LaunchConditions" />

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

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

【问题讨论】:

    标签: wix custom-action launch-condition


    【解决方案1】:

    不要将其安排在 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>
    

    【讨论】:

    • 我的自定义操作必须更改为 Execute="immediate" 而不是 defered 否则我会收到“错误代码为 2762”,并且仅在 InstallInitialize 之后和 AfterInstall 之前有效。
    猜你喜欢
    • 2023-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多