Я новичок в wix и Bootstrapper.Я создал два установщика с простыми текстовыми файлами. (Скажем, FirstInstaller и SecondInstaller).В первом установщике у меня есть модель представления и файлы конфигурации начальной загрузки.в модели View у меня есть свойство под названием «Имя».Также я определил переменную с тем же именем в файле Bundle.wxs, что и MsiProperty Name = "PARAM1" Value = "[PARAM1]" в одной из Msi.Теперь я хочу знать, как я могу использовать свое свойство viewmodel в файле bundle.wxs и как я могу отправить то же самое в конкретную MSI и как я могу получить то же самое в этой MSI.Помощь будет очень полезна, и я буду очень благодарен.
Я пытался сначала связать свойство, как в теге Bundle, чтобы просто проверить как, а также и
Bundle.wxs
<Bundle Name="!(bind.Name)" Version="1.0.0.0" Manufacturer="{Binding Name}" UpgradeCode="06A19F6F-688C-44A6-B3D3-26F72DE50689"
DisableModify="no">
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
<Payload Name="BootstrapperCore.config" SourceFile="$(var.InstallerUI.TargetDir)InstallerUI.BootstrapperCore.config" />
<Payload SourceFile="$(var.InstallerUI.TargetPath)" />
<Payload SourceFile="$(var.InstallerUI.TargetDir)Microsoft.Practices.Prism.Mvvm.dll" />
<Payload SourceFile="$(var.InstallerUI.TargetDir)Microsoft.Practices.Prism.Mvvm.Desktop.dll" />
<Payload SourceFile="$(var.InstallerUI.TargetDir)Microsoft.Practices.Prism.SharedInterfaces.dll" />
<Payload SourceFile="$(var.InstallerUI.TargetDir)Newtonsoft.Json.dll" />
<PayloadGroupRef Id="LicensePayload"/>
</BootstrapperApplicationRef>
<!-- Variables modified by custom WPF UI -->
<Variable bal:Overridable="yes" Name="Prerequisite" Value=""/>
<Variable bal:Overridable="yes" Name="InstallLevel" Value="1"/>
<Variable Name="PARAM1" Value="Hi This is Bharath Test1." bal:Overridable="yes" Type="string" Persisted="yes"/>
<Chain>
<PackageGroupRef Id='NetFx45Web' />
<MsiPackage Id="FirstInstaller" SourceFile="$(var.FirstInstaller.TargetPath)" Visible="yes">
<MsiProperty Name="PREREQUISITE" Value="[Prerequisite]"/>
<MsiProperty Name="INSTALLLEVEL" Value="[InstallLevel]"/>
<MsiProperty Name="PARAM1" Value="[PARAM1]" />
</MsiPackage>
<MsiPackage Id="SecondInstaller" SourceFile="$(var.SecondInstaller.TargetPath)" Visible="yes">
<MsiProperty Name="PREREQUISITE" Value="[Prerequisite]"/>
<MsiProperty Name="INSTALLLEVEL" Value="[InstallLevel]"/>
</MsiPackage>
<!--<MsiPackage Id="Installer" SourceFile="$(var.Installer.TargetPath)" Visible="yes">
<MsiProperty Name="PARAM1" Value="[Name]"/>
</MsiPackage>-->
</Chain>
InstallerMainWindowViewModel.cs
public InstallerMainWindowViewModel(BootstrapperApplication bootstrapper, Engine engine)
{
this.bootstrapper = bootstrapper;
this.engine = engine;
// For demo purposes, we set two variables here. They are passed on to the chained MSIs.
engine.StringVariables["Prerequisite"] = "1";
engine.StringVariables["InstallLevel"] = "100";
engine.StringVariables["PARAM1"]=Name;
private string _name;
public string Name
{
get { return this._name; }
set
{
_name = value;
OnPropertyChanged(Name);
}
}