これが私のセットアップです:
- .NET 4.0 でのコンパイル (これは変更できません)
- WiX 3.7 の使用
- WiX Extended Bootstrapper Application 拡張機能の使用
そこで、ブートストラッパーのインストール プロジェクトを作成しています。うまくいきましたが、もっとクリーンで簡単な方法があると思います。
基本的には、製品をインストールするときに使用する環境をユーザーに選択してもらう必要があります。これを行うには、WiX Extended Bootstrapper Application 拡張機能を使用して、最初のインストール画面にいくつかのラジオ ボタンを配置できるようにします。
すべての設定は問題ありませんでしたが、どのラジオ ボタンが選択されているかを簡単に
判断する
方法がわからないことに気付きました。そのため、回避策として、バンドルに MSI を 3 回リストし、それぞれにインストール条件を設定しました。
1 つのプロパティだけでどのラジオ ボタンが選択されているかを判断する方法はありますか?
(たとえば、InstallFolder
以下のコードに示すように、プロパティを MSIに渡す場合。)現在これを行う方法がない場合、MSI を 3 回追加せずにこれを行う方法はありますか?バンドル?
これが私のコードです(基本的に同じMsiPackage
3回をリストする方法に注意してください):
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<?include Properties.wxi ?>
<Bundle Name="!(loc.Product.Name)" Version="$(var.Version)" Manufacturer="!(loc.Product.Manufacturer)" UpgradeCode="$(var.UpgradeCode)" Condition="VersionNT >= v5.1">
<BootstrapperApplicationRef Id="WixExtendedBootstrapperApplication.Hyperlink2License">
<bal:WixExtendedBootstrapperApplication SuppressRepair="yes" LicenseUrl="" ThemeFile="$(var.Bundle.ExtTheme.RadioBtns.Path)" LocalizationFile="$(var.Bundle.ExtTheme.RadioBtns.l10n.Path)" />
</BootstrapperApplicationRef>
<WixVariable Id="WixMbaPrereqPackageId" Value="Netfx4Full" />
<Variable Name="InstallFolder" Type="string" Value="$(var.InstallFolder.Value)" />
<Variable Name="RadioButton1" Type="numeric" Value="0" />
<Variable Name="RadioButton2" Type="numeric" Value="0" />
<Variable Name="RadioButton3" Type="numeric" Value="1" />
<Chain>
<!-- Other Package References Here -->
<MsiPackage Id="DBConnections_Dev"
SourceFile="$(var.MSI.Path)"
Visible="no"
Vital="yes"
InstallCondition="RadioButton1 = 1">
<MsiProperty Name="INSTALLFOLDER" Value="[InstallFolder]" />
<MsiProperty Name="SELECTED_ENV" Value="1" />
</MsiPackage>
<MsiPackage Id="DBConnections_Stage"
SourceFile="$(var.MSI.Path)"
Visible="no"
Vital="yes"
InstallCondition="RadioButton2 = 1">
<MsiProperty Name="INSTALLFOLDER" Value="[InstallFolder]" />
<MsiProperty Name="SELECTED_ENV" Value="2" />
</MsiPackage>
<MsiPackage Id="DBConnections_Prod"
SourceFile="$(var.MSI.Path)"
Visible="no"
Vital="yes"
InstallCondition="RadioButton3 = 1">
<MsiProperty Name="INSTALLFOLDER" Value="[InstallFolder]" />
<MsiProperty Name="SELECTED_ENV" Value="3" />
</MsiPackage>
</Chain>
</Bundle>
</Wix>