title: Why does managed bootstrapper application always install .Net framework no matter the .net framework exists or not?
body: <p>If WixVariables <code>WixMbaPrereqPackageId</code> and <code>WixMbaPrereqLicenseUrl</code> are not added, it fails to compile.  </p>
  
  <blockquote>
    <p>The Windows Installer XML variable <code>!(wix.WixMbaPrereqPackageId)</code> is unknown.<br>
    The Windows Installer XML variable <code>!(wix.WixMbaPrereqLicenseUrl)</code> is unknown.  </p>
  </blockquote>
  
  <p>If the two variables are added, even though my test computer has .NET Framework 4.0 installed, the bootstrapper installs .NET Framework 4.0 every time.</p>
  
  <p>How to avoid installing .NET Framework when the target computer already has the .NET framework?</p>
  
  <p>Below is my sample code. </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"&gt;
      &lt;Bundle Name="TestBootstrapper" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="e8c02687-b5fe-4842-bcc4-286c2800b556"&gt;    
  &lt;BootstrapperApplicationRef Id='ManagedBootstrapperApplicationHost'&gt;
        &lt;Payload SourceFile='MyBA.dll' /&gt;
      &lt;/BootstrapperApplicationRef&gt;
  
      &lt;!--&lt;BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" /&gt;--&gt;
  
          &lt;Chain&gt;
        &lt;PackageGroupRef
                  Id="Netfx4Full"/&gt;
        &lt;MsiPackage Name="SetupProject1.msi" SourceFile="data\SetupProject1.msi" DownloadUrl="http://myserver/SetupProject1.msi" Compressed="no"&gt;
        &lt;/MsiPackage&gt;
        &lt;MsiPackage Name="SetupProject2.msi" SourceFile="data\SetupProject2.msi" DownloadUrl="http://myserver/SetupProject2.msi" Compressed="no"&gt;
        &lt;/MsiPackage&gt;
          &lt;/Chain&gt;
      &lt;/Bundle&gt;
  
    &lt;Fragment&gt;
      &lt;WixVariable
          Id="WixMbaPrereqPackageId"
          Value="Netfx4Full" /&gt;
      &lt;WixVariable
          Id="WixMbaPrereqLicenseUrl"
          Value="NetfxLicense.rtf" /&gt;
  
      &lt;util:RegistrySearch
          Root="HKLM"
          Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
          Value="Version"
          Variable="Netfx4FullVersion" /&gt;
      &lt;util:RegistrySearch
          Root="HKLM"
          Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
          Value="Version"
          Variable="Netfx4x64FullVersion"
          Win64="yes" /&gt;
  
      &lt;PackageGroup Id="Netfx4Full"&gt;
        &lt;ExePackage
            Id="Netfx4Full"
            Cache="no"
            Compressed="no"
            PerMachine="yes"
            Permanent="yes"
            Vital="yes"
            SourceFile="dotNetFx40_Full_x86_x64.exe"
            DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=164193"
            DetectCondition="Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)" /&gt;
      &lt;/PackageGroup&gt;
    &lt;/Fragment&gt;
  &lt;/Wix&gt;
  </code></pre>