WiX:无法处理“安装后启动应用程序”复选框= 0

Max*_*axs 2 custom-action wix

我正在使用带有“安装后启动应用程序”复选框的WiX进行安装。目标是对设置复选框和取消设置复选框有反应。如果选中了此复选框,则需要运行一个应用程序。如果未设置该复选框,则需要使用命令行参数运行相同的应用程序。

这是我的WiX脚本的一部分。

<CustomAction Id="StartConfigManagerOnExit"
              FileKey="ParamsShower.exe"
              ExeCommand=""
              Execute="immediate"
              Impersonate="yes"
              Return="asyncNoWait" />
<CustomAction Id="StartUpgradeConfigOnExit"
              FileKey="ParamsShower.exe"
              ExeCommand="/upgrade"
              Execute="immediate"
              Impersonate="yes"
              Return="asyncNoWait" />
<UI>
    <Publish Dialog="ExitDialogEx"
             Control="Finish"
             Order="1"
             Event="DoAction"
             Value="StartConfigManagerOnExit">LAUNCHAPPONEXIT = 1</Publish>
    <Publish Dialog="ExitDialogEx"
             Control="Finish"
             Order="1"
             Event="DoAction"
             Value="StartUpgradeConfigOnExit">LAUNCHAPPONEXIT = 0</Publish>
    <Publish Dialog="ExitDialogEx"
             Control="Finish"
             Event="EndDialog"
             Value="Return"
             Order="999">1</Publish>

    <Dialog Id="ExitDialogEx"
            Width="370"
            Height="270"
            Title="[ProductName] Setup">
        <Control Id="LaunchCheckBox"
                 Type="CheckBox"
                 X="135"
                 Y="190"
                 Width="220"
                 Height="40"
                 Property="LAUNCHAPPONEXIT"
                 Hidden="yes"
                 CheckBoxValue="1"
                 Text="Launch an app">
           <Condition Action="show">NOT Installed</Condition>
        </Control>
    </Dialog>
    <InstallUISequence>
       <Show Dialog="ExitDialogEx"
             OnExit="success" />
    </InstallUISequence>
    <AdminUISequence>
        <Show Dialog="ExitDialogEx"
              OnExit="success" />
    </AdminUISequence>
</UI>
Run Code Online (Sandbox Code Playgroud)

设置LaunchCheckBox时,安装会启动应用程序。但是如果未设置复选框,它不会运行。

Max*_*axs 5

我找到了答案。取消选中后,看起来checkbox属性不等于0。只需将条件“ LAUNCHAPPONEXIT = 0”更改为“ NOT LAUNCHAPPONEXIT”即可解决这种情况。

使默认:

<Property Id="LAUNCHAPPONEXIT" Value="1" />
Run Code Online (Sandbox Code Playgroud)

然后更正条件(用sascha的注释更正):

<Publish Dialog="ExitDialogEx" Control="Finish" Order="1" Event="DoAction" Value="StartConfigManagerOnExit">LAUNCHAPPONEXIT</Publish>
<Publish Dialog="ExitDialogEx" Control="Finish" Order="1" Event="DoAction" Value="StartUpgradeConfigOnExit">NOT LAUNCHAPPONEXIT</Publish>
Run Code Online (Sandbox Code Playgroud)