title: WiX - Install Prerequisites and 3rd party applications
body: <p>I have a wix Windows Installer for my C# application. Things are working, I am able to install and uninstall the application. But I have few Prerequisites and other 3rd party applications that I want to install with my application.</p>
  
  <p>Prerequisites:</p>
  
  <ol>
  <li>Microsoft .NET Framework 4 (x86 and x64) - <strong>dotNetFx40_Full_x86_x64.exe</strong></li>
  <li>SQL Server 2008 Express
  
  <ol>
  <li><strong>SQLEXPR_x64_ENU.EXE</strong></li>
  <li><strong>SQLEXPR32_x86_ENU.EXE</strong></li>
  </ol></li>
  <li>SQL Server Compact 3.5 SP2
  
  <ol>
  <li><strong>SSCERuntime-ENU.msi</strong></li>
  <li><strong>SSCERuntime-ENU-x64.msi</strong></li>
  </ol></li>
  </ol>
  
  <p>3rd Party Application:</p>
  
  <ol>
  <li>TeamViewer - <strong>TeamViewer_Setup.exe</strong></li>
  </ol>
  
  <p>So of-course I am not looking for complete guidelines for all the Prerequisites and 3rd party applications. I just need you folks help on figuring out on how exactly I can embed these <code>exe</code> and <code>msi</code> setups to be a part of my <code>wix</code> installation.</p>
  
  <p>Also, some are for <code>x64</code> and some are for <code>x86</code>, so it should be capable enough to handle the OS version and architecture. How will this be accomplished with wix.</p>
  
  <p>I have been searching on internet for a while now and nothing concrete seems to be working for me.</p>
  
  <p>I need to make sure that if these applications are not installed then the software should also not install. Along with that if any of the prerequisite or 3rd party application is already installed then it should not install again.</p>
  
  <p>I guess this can be done using some wix tools but I am not able to get any concrete instructions on howto.</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>Ok I have got the <code>Microsoft .NET Framework 4 (x86 and x64)</code> installed, and the problem which I am facing now is I am unable to install <code>SQL Server Compact 3.5 SP2</code>. I am doing things one by one to make things more clear to me. Here under I am sharing my code so that you people can review:</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="Bootstrapper" Version="1.0.0.0" Manufacturer="Billy"
          UpgradeCode="PUT-GUID-HERE"&gt;
    &lt;BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" /&gt;
    &lt;Chain&gt;
  
      &lt;PackageGroupRef Id="Netfx4Full"/&gt;
      &lt;PackageGroupRef Id="SQLExpressCE"/&gt;
  
      &lt;!-- Install Application --&gt;
      &lt;MsiPackage Id="MyApplication" SourceFile="$(var.Installer.TargetPath)"/&gt;
  
    &lt;/Chain&gt;
  &lt;/Bundle&gt;
  
  &lt;Fragment&gt;
    &lt;!-- Check for .NET 4.0 --&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;!-- Install .NEt 4.0 --&gt;
    &lt;PackageGroup Id="Netfx4Full"&gt;
      &lt;ExePackage Id="Netfx4Full"
                  DisplayName="Microsoft .NET Framework 4.0"
                  Compressed="no"
                  Cache="yes"
                  PerMachine="yes"
                  Permanent="yes"
                  Protocol="netfx4"
                  Vital="yes"
                  SourceFile=".\prerequisites\dotNetFx40_Full_x86_x64.exe"
                  InstallCommand="/passive /norestart"
                  DetectCondition="Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)" /&gt;
    &lt;/PackageGroup&gt;
  
    &lt;!-- Install SQL Server CE --&gt;
    &lt;PackageGroup Id="SQLExpressCE"&gt;
      &lt;MsiPackage
                Cache="no"
                Compressed="no"
                ForcePerMachine="yes"
                Permanent="yes"
                Vital="yes"
                SourceFile=".\prerequisites\SSCERuntime-ENU.msi"
                InstallCondition="NOT VersionNT64 AND SqlInstance AND SqlServerInstalled AND SQLServer2008R2Installed" /&gt;
      &lt;MsiPackage
                Cache="no"
                Compressed="no"
                ForcePerMachine="yes"
                Permanent="yes"
                Vital="yes"
                SourceFile=".\prerequisites\SSCERuntime-ENU-x64.msi"
                InstallCondition="VersionNT64 AND NOT SqlInstance AND SqlServerInstalled AND SQLServer2008R2Installed" /&gt;
    &lt;/PackageGroup&gt;
  
  &lt;/Fragment&gt;
  &lt;/Wix&gt;
  </code></pre>
  
  <p><strong>NOTE:</strong> The above code installs <code>.NET Framework</code>, its not installing <code>SQL Server Compact 3.5 SP2</code></p>
  
  <hr>
  
  <p><strong>EDIT -2</strong></p>
  
  <p>After Referring <code>Tom Blodget</code> answer I have reached to this far, however I am unable to understand how to give the Install Command for my SQL Exe package and same for my MSI package. I have also gone through this answer <a href="https://stackoverflow.com/a/19010097/1182021">https://stackoverflow.com/a/19010097/1182021</a> of <code>Mr. Neil Sleightholm</code> but this one is for <code>SQL 2012</code>, how can I do this same thing with <code>SQL 2008 Server</code> and <code>CE</code> (The conditions and steps)</p>
  
  <pre><code>&lt;PackageGroup Id="SQLExpressCE"&gt;
    &lt;ExePackage
              Cache="no"
              Compressed="no"
              Permanent="no"
              Vital="yes"
              InstallCommand="/QS /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS /BROWSERSVCSTARTUPTYPE=Automatic /SQLSVCSTARTUPTYPE=Automatic /FEATURES=SQL /INSTANCENAME=SQLEXPRESS /SQLSVCACCOUNT=&amp;quot;NT AUTHORITY\Network Service&amp;quot; /SQLSYSADMINACCOUNTS=&amp;quot;BUILTIN\ADMINISTRATORS&amp;quot; /AGTSVCACCOUNT=&amp;quot;NT AUTHORITY\Network Service&amp;quot; /SECURITYMODE=SQL /SAPWD=&amp;quot;wegamed&amp;quot;"
              SourceFile=".\prerequisites\SQLEXPR32_x86_ENU.EXE"
              DownloadUrl="http://download.microsoft.com/download/D/1/8/D1869DEC-2638-4854-81B7-0F37455F35EA/SQLEXPR_x86_ENU.exe"
              InstallCondition="NOT SQLServer2008R2Installed AND NOT SQLServerInstalled" /&gt;
    &lt;ExePackage DetectCondition="VersionNT64"
              Cache="no"
              Compressed="no"
              Permanent="no"
              Vital="yes"
              InstallCommand="/QS /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS /BROWSERSVCSTARTUPTYPE=Automatic /SQLSVCSTARTUPTYPE=Automatic /FEATURES=SQL /INSTANCENAME=SQLEXPRESS /SQLSVCACCOUNT=&amp;quot;NT AUTHORITY\Network Service&amp;quot; /SQLSYSADMINACCOUNTS=&amp;quot;BUILTIN\ADMINISTRATORS&amp;quot; /AGTSVCACCOUNT=&amp;quot;NT AUTHORITY\Network Service&amp;quot; /SECURITYMODE=SQL /SAPWD=&amp;quot;wegamed&amp;quot;"
              SourceFile=".\prerequisites\SQLEXPR_x64_ENU.EXE"
              DownloadUrl="http://download.microsoft.com/download/D/1/8/D1869DEC-2638-4854-81B7-0F37455F35EA/SQLEXPR_x86_ENU.exe"
              InstallCondition="NOT SQLServer2008R2Installed AND NOT SQLServerInstalled" /&gt;
  &lt;/PackageGroup&gt;
  </code></pre>
  
  <p>But Setup is unable to complete. I guess it is because of the install commands as it works till accept licence agreement.</p>