Customising the WiX Burn theme with additional inputs

我怕爱的太早我们不能终老 提交于 2019-12-30 04:01:11

问题


I'm looking at using Burn as a bootstrapper for an installer and I need to pass in a couple of arguments into the MSI.

I know that the way to do this is to use MsiProperty elements, the issue I am having is with displaying the UI to capture those properties. I'm aware that I can create a completely custom UI via the managed bootstrapper application host, however this is turning out to be a lot of work to implement for a relatively minor tweak to the bootstrapper.

I've found this blog article with describes how to do basic UI customisations and wondered if its possible to modify the Burn UI to include a simple checkbox / textbox (whose value is then use to set a Burn variable so I can pass it into my MSI) in a similar way, or do I need to use the managed bootstrapper application host after all?


回答1:


I cant find any documentation on this anywhere, but a little bit of experimentation + reading through the source code reveals that this is fairly straightforward - just set the Name of the control (e.g. Checkbox) to the name of a Burn variable (not a WiX variable - they are different), like so (see Burn UI Customisations for more info on where to put this)

<Checkbox Name="MyCheckBox" ...>Hello, checkbox</Checkbox>

If you like you can define a burn variable beneath your bundle to initialise it to some value (use 1 for "ticked" and 0 for "unticked" with checkboxes)

<Variable Name="MyCheckBox" Value="1" />

However its not required - the variable will be created automatically for you anyway. Note that it needs to be a Variable, not a WixVariable - these are different.

Finally to set an MSI property based on this variable add a MsiProperty element as a child of your MsiPackage element, like so

<MsiPackage Name="MyMsi.msi" ...>
    <MsiProperty Name="SOMEPROPERTY" Value="[MyCheckBox]" />
</MsiPackage>

The value of the MSI property "SOMEPROPERTY" will then be set to 0 or 1 based on the checked state of your checkbox.



来源:https://stackoverflow.com/questions/12323106/customising-the-wix-burn-theme-with-additional-inputs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!