Bootstrapperでスタンドアロンインストーラーを使用して.NET Framework 4.0をインストールする

  1. 開発環境にWix 3.6がインストールされているものとする
  2. [ファイル]-[新規作成]-[プロジェクト]から[Windows Installer XML]-[Bootstrapper Project]を選択
  3. [ソリューションエクスプローラー]内、作成したプロジェクトの[References]を右クリックして[参照の追加]を選択
  4. "WixUtilExtension.dll"をダブルクリックして参照追加し、[OK]で閉じる
  5. "Bundle.wxs"を編集
  <?xml version="1.0" encoding="UTF-8"?>
  <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
    <Bundle Name="Bootstrapper1" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="7b9b29fa-c337-4647-bc7e-c859198bfba4">
        <WixVariable Id="WixMbaPrereqPackageId" Value="NetFx40FullLocal"/>
        <WixVariable Id="WixMbaPrereqLicenseUrl" Value=""/>

        <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />

        <util:RegistrySearch
            Id="NETFRAMEWORK40"
            Variable="NETFRAMEWORK40"
            Root="HKLM"
            Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full"
            Value="Install"
            Result="value"/>

        <Chain>
            <ExePackage
                InstallCommand="/q /norestart /ChainingPackage &quot;[WixBundleName]&quot;"
                RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot;"
                UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot;"
                PerMachine="yes"
                DetectCondition="NETFRAMEWORK40"
                Id="NetFx40FullLocal"
                Vital="yes"
                Permanent="yes"
                Protocol="netfx4"
                Compressed="yes"
                Name="redist\dotNetFx40_Full_setup.exe"
                SourceFile="$(sys.SOURCEFILEDIR)redist\dotnetfx40_full_x86_x64.exe"/>

            <!-- TODO: Define the list of chained packages. -->
            <!-- <MsiPackage SourceFile="path\to\your.msi" /> -->
        </Chain>
    </Bundle>
  </Wix>
  1. ExePackageのSourceFileで指定した場所に.NET Framework 4.0のスタンドアロンインストーラーを配置してプロジェクトをコンパイル
  2. 作成されたexeファイルをテスト環境(ex. Windows XP SP3、インターネット接続無し)で実行すると、.NET Frameworkがインストールされた後にManagedなInstaller UIが表示される