如何在WiX中创建条件属性?(几乎像If-Then)

Gra*_*ant 4 installer wix

我有一个安装一些EXE文件的WiX项目.一个是'Main'可执行文件,其他是支持帮助诊断问题的程序.

主可执行文件是可选的,支持程序将自行运行.通常,最终用户将安装第三方程序而不是我的主要可执行文件.

在WiX安装程序结束时,我希望有一个"启动程序"复选框,一旦安装程序关闭,它就会运行程序.

我可以根据INSTALLLEVEL属性隐藏复选框,但这只会根据用户是选择"典型"还是"完成"安装而更改.我想根据是否安装了主要的可执行文件功能来隐藏它.

这样的事情是理想的:

<Feature Id='MainProgram' Title='MainExe'
         Description='This application stores and displays information from our hardware.'
         ConfigurableDirectory='INSTALLDIR' Level='4'
         AllowAdvertise='no'>
    <ComponentRef Id='MainExecutable' />
    <ComponentRef Id='SQLLibrary' />
    <ComponentRef Id='ProgramIcon' />
    <ComponentRef Id='RemovePluginsFolder'/>
    <Property Id='ShowFinalCheckbox'>1</Property> #<--This won't work, but I'd like it to.
</Feature>
Run Code Online (Sandbox Code Playgroud)

Rob*_*ing 10

SetProperty元素可用于在操作之前或之后更改Property的值.要根据可执行文件的安装状态设置值,我将使用MSI SDK中的条件语句语法中记录的组件状态的组合.你将不得不玩这个例子,但我认为这会让你接近.

<SetProperty Id="ShowFinalCheckBox" Value="1" After="CostFinalize">?MainExecutableComponent&gt;2 OR $MainExecutableComponent&gt;2</SetProperty>
Run Code Online (Sandbox Code Playgroud)

其中的所有魔术都在上面的MSI SDK链接中进行了解释.