WiX:如何访问/更改托管引导程序中的安装目录?
我正在创建一个带有自定义用户界面的WPF设置应用程序。 我从Bryan P. Johnston的教程开始: http : //bryanpjohnston.com/2012/09/28/custom-wix-managed-bootstrapper-application/
在我看来,我有一个简单的TextBox
绑定到MainViewModel
的Property InstallationPath
。
现在,我希望在用户单击“安装”时使用此路径。 为此,我有一个绑定到我的InstallCommand
的按钮。 调用以下方法(直接从教程中获取):
private void InstallExecute() { Bootstrapper.Engine.Plan(LaunchAction.Install); }
如何将软件包安装到我的属性InstallationPath
的目录中?
编辑:
我在Stackoverflow上发现了一个类似的问题:
在Burn托管引导程序内指定WiX中的软件包的INSTALLLOCATION
答案来自Bob Arnson
为每个MsiPackage使用MsiProperty子项指定INSTALLLOCATION = [BurnVariable]。 然后使用Engine.StringVariables设置BurnVariable。
现在,我想我可以像这样访问InstallExecute
的StringVariables
private void InstallExecute() { Bootstrapper.Engine.StringVariables["BurnVariable"] = InstallationPath; Bootstrapper.Engine.Plan(LaunchAction.Install); }
但是在哪里定义这个变量? 我想在Product.wxs的某个地方?
是的,只需在刻录引导程序中创建一个变量:
然后,您可以将此参数作为参数传递给引导程序的msi程序包:
Bundle Variable元素上缺少一个属性“Type”。 caverman_dick是正确的但是当不可覆盖时这不能正常工作。 您也可以尝试这一点,设置Type =“string”。
Wix变量元素
......