2010-02-16 93 views
2

我正在使用具有「安裝後啓動應用程序」複選框的WiX進行安裝。 目標是對設置複選框以及取消複選框的反應。如果複選框已設置,我需要運行一個應用程序。如果複選框沒有設置,我需要運行相同的應用程序,但使用命令行參數。WiX:無法處理「在安裝後啓動應用程序」複選框= 0

這是我的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

我找到了答案。看起來像複選框屬性不等於0時,未選中。只需將條件「LAUNCHAPPONEXIT = 0」更改爲「NOT LAUNCHAPPONEXIT」即可解決問題。

設爲默認:

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

然後更正條件(與薩沙的評論校正):

<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> 
0

您需要添加初始化爲你的財產自定義操作,

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

,然後顯示退出對話框之前添加到InstallUISequence,或者乾脆你的屬性添加到產品<Property Id="LAUNCHAPPONEXIT" Value="0" />

+0

我已將設置爲。 現在,如果複選框已設置,則啓動StartUpgradeConfigOnExit(LAUNCHAPPONEXIT = 0)。如果複選框未設置,則不發生任何事情。 – Maxs 2010-02-16 12:30:12

3

一個複選框沒有任何價值可言的時候不加以控制,因此而不是使用1/0符號,你可以簡單地使用

LAUNCHAPPONEXIT 

Not LAUNCHAPPONEXIT 
相關問題