11

我有一些我只想在升级场景中执行的自定义操作。

我正在尝试设置一些属性,例如“MYPROPERTY”...当我通过标准安装进入时,我可以设置它们,该 XML 的示例如下...

<Custom Action="SetMyPropertyToOn" After="exampleActionRuuningBeforeThisOne"> (ENABLEMYPROPERTY_CB) AND (NOT ENABLEMYPROPERTY_CB="0") AND (NOT ENABLEMYPROPERTY) AND (NOT Installed)</Custom>

它在正常安装中运行......我也希望它在升级场景中运行。

4

1 回答 1

32

我在所有设置中都使用它:

    <SetProperty After="FindRelatedProducts" Id="FirstInstall" Value="true">
        NOT Installed AND NOT WIX_UPGRADE_DETECTED AND NOT WIX_DOWNGRADE_DETECTED
    </SetProperty>
    <SetProperty After="SetFirstInstall" Id="Upgrading" Value="true">
        WIX_UPGRADE_DETECTED AND NOT (REMOVE="ALL")
    </SetProperty>
    <SetProperty After="RemoveExistingProducts" Id="RemovingForUpgrade" Sequence="execute" Value="true">
        (REMOVE="ALL") AND UPGRADINGPRODUCTCODE
    </SetProperty>
    <SetProperty After="SetUpgrading" Id="Uninstalling" Value="true">
        Installed AND (REMOVE="ALL") AND NOT (WIX_UPGRADE_DETECTED OR UPGRADINGPRODUCTCODE)
    </SetProperty>
    <SetProperty After="SetUninstalling" Id="Maintenance" Value="true">
        Installed AND NOT Upgrading AND NOT Uninstalling AND NOT UPGRADINGPRODUCTCODE
    </SetProperty>

然后,您可以安排您的自定义操作仅在升级时运行:

<Custom Action="NameOfCustomAction" Before="InstallFinalize"><![CDATA[Upgrading= "true"]]></Custom>
于 2013-08-30T11:33:23.180 回答