使用附加输入自定义 WiX Burn 主题 [英] Customising the WiX Burn theme with additional inputs

查看:26
本文介绍了使用附加输入自定义 WiX Burn 主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑使用 Burn 作为安装程序的引导程序,我需要将几个参数传递到 MSI.

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.

我知道这样做的方法是使用 MsiProperty 元素,我遇到的问题是显示 UI 以捕获这些属性.我知道我可以通过托管引导程序应用程序主机创建一个完全自定义的 UI,但是结果证明这需要大量工作才能对引导程序进行相对较小的调整.

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.

我发现这篇博客文章描述了如何进行基本的 UI 自定义,并想知道是否可以以类似的方式修改 Burn UI 以包含一个简单的复选框/文本框(然后使用其值设置 Burn 变量,以便我可以将其传递到我的 MSI),或者毕竟我需要使用托管引导程序应用程序主机吗?

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?

推荐答案

我在任何地方都找不到关于此的任何文档,但是一点点实验 + 阅读源代码表明这相当简单 - 只需设置 名称控件(例如复选框)到 Burn 变量的名称(不是 WiX 变量 - 它们是不同的),就像这样(参见 Burn UI Customisations 以获取有关将其放在哪里的更多信息)

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>

如果你愿意,你可以在你的bundle下定义一个burn变量来将它初始化为某个值(使用1表示勾选",0表示未勾选"复选框)

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" />

但是它不是必需的 - 无论如何都会自动为您创建变量.请注意,它必须是 Variable,而不是 WixVariable - 它们是不同的.

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.

最后根据这个变量设置一个 MSI 属性,添加一个 MsiProperty 元素作为 MsiPackage 元素的子元素,就像这样

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>

MSI 属性SOMEPROPERTY"的值将根据复选框的选中状态设置为 0 或 1.

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

这篇关于使用附加输入自定义 WiX Burn 主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆