2

我正在使用带有“安装后启动应用程序”复选框的 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>

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

4

3 回答 3

5

我找到了答案。未选中时,复选框属性看起来不等于 0。只需将条件“LAUNCHAPPONEXIT = 0”更改为“NOT LAUNCHAPPONEXIT”即可解决问题。

使默认:

<Property Id="LAUNCHAPPONEXIT" Value="1" />

然后更正条件(用 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>
于 2010-02-16T14:00:43.437 回答
3

未选中时,复选框根本没有任何价值,因此您可以简单地使用,而不是使用 1/0 表示法

LAUNCHAPPONEXIT

Not LAUNCHAPPONEXIT
于 2010-02-17T05:00:27.867 回答
0

您需要为您的属性添加初始化自定义操作,

<CustomAction ID="InitLAUNCHAPPONEXIT" 
              Property="LAUNCHAPPONEXIT" 
              Value="0" 
              Return="check"/> 

然后在显示退出对话框之前将其添加到 InstallUISequence ,或者只是将您的属性添加到 product <Property Id="LAUNCHAPPONEXIT" Value="0" />

于 2010-02-16T11:31:44.640 回答