WiX:如何访问/更改托管引导程序中的安装目录? [英] WiX: how to access / change installation directory in managed bootstrapper?

查看:67
本文介绍了WiX:如何访问/更改托管引导程序中的安装目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用自定义用户界面创建WPF设置应用程序.我从Bryan P. Johnston的教程开始: http://bryanpjohnston.com/2012/09/28/custom-wix-managed-bootstrapper-application/

I am creating a WPF setup application with a custom user interface. I started with the tutorial of Bryan P. Johnston: http://bryanpjohnston.com/2012/09/28/custom-wix-managed-bootstrapper-application/

在我看来,有一个简单的 TextBox 绑定到了 MainViewModel 中的属性 InstallationPath .

Somewhere in my view, I have a simple TextBox that binds to a Property InstallationPath in my MainViewModel.

现在,我希望在用户单击安装"时使用此路径.为此,我有一个绑定到我的 InstallCommand 的按钮.调用以下方法(直接从教程中获取):

Now I want this path to be used when the user clicks on "Install". For this, I have a button that binds to my InstallCommand. The following method is called (taken directly from the tutorial):

private void InstallExecute()
{
    Bootstrapper.Engine.Plan(LaunchAction.Install);
}

如何使软件包安装到属性 InstallationPath 的目录中?

How can I make the packages to be installed into the directory of my property InstallationPath?

我在Stackoverflow上发现了类似的问题:

I found a similar question here on Stackoverflow:

指定在WiX中安装软件包在Burn管理的引导程序内

那里的答案来自鲍勃·阿恩森

The answer there is from Bob Arnson

为每个MsiPackage使用一个MsiProperty子级来指定INSTALLLOCATION = [BurnVariable].然后使用Engine.StringVariables设置BurnVariable.

Use an MsiProperty child for each MsiPackage to specify INSTALLLOCATION=[BurnVariable]. Then use Engine.StringVariables to set BurnVariable.

现在,我想我可以像这样

Now, I think I could access the StringVariables in my InstallExecute like this

private void InstallExecute()
{
    Bootstrapper.Engine.StringVariables["BurnVariable"] = InstallationPath;
    Bootstrapper.Engine.Plan(LaunchAction.Install);
}

但是在哪里定义这个变量呢?我猜在Product.wxs中的某个地方?

But where to define this variable? I guess somewhere in Product.wxs?

推荐答案

是的,只需在刻录引导程序中创建一个变量:

Yes just create a variable in your burn bootstrapper:

<Variable Name="BurnVariable"
          bal:Overridable="yes" />

然后您可以将其作为参数传递给引导受限的msi软件包:

you can then pass this as a parameter to your boot-strapped msi package:

<MsiPackage SourceFile="$(var.YourMsiProject.Installer.TargetPath)" Compressed="no">
    <MsiProperty Name="INSTALLLOCATION" Value="[BurnVariable]" />          
</MsiPackage>

这篇关于WiX:如何访问/更改托管引导程序中的安装目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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