简体   繁体   English

更改托管引导程序(WPF)中的属性(MSI)?

[英]Change property (msi) in managed bootstrapper (wpf)?

A have a WPF Setup Application. 有一个WPF设置应用程序。 I Have TextBox that binds to a Property ProductCode in my ViewModel. 我的TextBox绑定到ViewModel中的属性ProductCode

How can I make the packages to be set " DEF " property in .msi project? 如何在.msi项目中将软件包设置为“ DEF ”属性?

My code: 我的代码:

WPF: WPF:

 private void InstallExecute()
        {
            InstallEnabled = false;
            Bootstrapper.Engine.StringVariables["ABC"] = "zyx";
            MainWindowViewModel.PlanAction(LaunchAction.Install);
        }

Bootstrapper: 引导程序:

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

<MsiProperty Name="DEF" Value="[ABC]"/>

.MSI: .MSI:

 <Property Id="DEF" />

Project with Action: 行动计划:

var test = session["DEF"].ToString(); //always gives empty string

You need to specify the MsiProperty like this inside your bundle: 您需要在捆绑包中这样指定MsiProperty:

<MsiPackage Id='MyApp' Description='My Application' SourceFile="$(var.SetupMyApp.TargetPath)">
  <MsiProperty Name="INSTALLFOLDER" Value="[MyAppInstallLocation]"/>
</MsiPackage>

Add a burn variable for it, also in the bundle: 在捆绑包中为其添加刻录变量:

<Variable bal:Overridable="yes" Name="MyAppInstallLocation" Value=""/>

And then 接着

Bootstrapper.Engine.StringVariables["MyAppInstallLocation"] = "C:\MyApp";

somewhere in your bootstrapper, obviously before you start the install. 引导程序中的某个位置,显然是在开始安装之前。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM