title: Wix: How to specify a pre-installation detection
body: <p>I‘m reading wix’s tutorial and manuals, and trying to figure out how to apply a pre-installation detection, say detecting if Visual Studio 2012 and Update 2 has been installed on the machine.</p>
  
  <p>the following is a wix source code, but I'm not sure whether the registry keys are prerequisite for detection.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:dd="http://schemas.microsoft.com/wix/2005/01/dd"&gt;
  &lt;!-- Detection keys fragment. --&gt;
  &lt;Fragment&gt;
      &lt;!-- TARGETDIR should be set by a type 51 CA to the root installation location for all products. --&gt;
      &lt;DirectoryRef Id="TARGETDIR"&gt;
          &lt;!-- Use all variables in the full key path for the auto-generated GUID, 
               including LANG, since [ProductName] is lang-specific. 
          --&gt;
          &lt;Component Id="Detection_Keys_Reg" Guid="$(autoguid.ComponentGuid(Detection_Keys_Reg,$(var.ProductFamily),$(var.ProductEdition),$(var.VSRegVer),$(var.Lang)))"&gt;
              &lt;RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\$(var.VSRegVer)\Setup\[ProductName]"&gt;
                  &lt;RegistryValue Id="Detection_Keys_RegKey_1" Name="InstallSuccess" Type="integer" Value="1" KeyPath="yes" /&gt;
                  &lt;RegistryValue Id="Detection_Keys_RegKey_2" Name="SrcPath" Type="string" Value="[SourceDir]" /&gt;
              &lt;/RegistryKey&gt;
          &lt;/Component&gt;
      &lt;/DirectoryRef&gt;
      &lt;Feature Id="Detection_Keys" Absent="disallow" AllowAdvertise="no" Description="Used to detect product installation" Display="hidden" Level="1" InstallDefault="local" Title="Detection" TypicalDefault="install"&gt;
          &lt;ComponentRef Id="Detection_Keys_Reg" /&gt;
          &lt;dd:ExtensionData FeatureGuid="67DC7E25-1836-42AA-A0F8-6E85528D6986" InstallDirectory="TARGETDIR" AllowRunFromSource="no" FeatureGFN="DetectionKeys"&gt;Detection Keys&lt;/dd:ExtensionData&gt;
      &lt;/Feature&gt;
  &lt;/Fragment&gt;
  </code></pre>
  
  <p></p>
  
  <p>The two registry keys in folder</p>
  
  <p>"HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config\Setup\Microsoft Visual Studio Ultimate 2012\"</p>
  
  <p>do exist (but not in HKLM) after my installing VS2012. I don't understand some of the tags (still reading the manual)</p>
  
  <p>so the questions are:
  1. Is this for detection?  2. How do I write some pop up messages when the required software does not exist.</p>
  
  <p>Can you provide some typical samples for this purpose?</p>
  
  <p>Thanks!</p>