title: How to check for the existence of an IIS 7 web site via WiX 3.5?
body: <p><em>Note: This question can also be found on the <a href="http://www.mail-archive.com/wix-users@lists.sourceforge.net/msg42390.html" rel="nofollow">WiX mailing list</a>.</em></p>
  
  <p>I need to be able to check for the existence of an IIS7 website based on the website's description. If the website does not exist I need to cancel the installation. If the website exists I want to continue the installation. I also need to be able to save the site id of the website so that I may use it during an uninstall.</p>
  
  <p>For debugging purposes I have hard coded the website's description.  I do not see any indication that a check for the website is being made within the MSI log file.  This is the code I am using:</p>
  
  <pre><code> &lt;iis:WebSite Id="IISWEBSITE" Description="Default Web Site" SiteId="*"&gt;
        &lt;iis:WebAddress Id="IisWebAddress" Port="1"/&gt;
   &lt;/iis:WebSite&gt;
  
   &lt;Condition Message="Website [IISWEBSITE] not found."&gt;
        &lt;![CDATA[IISWEBSITE]]&gt;
   &lt;/Condition&gt;
  </code></pre>
  
  <p>Using ORCA I can see that IIsWebAddress and IIsWebSite tables are added to the MSI. The values are:</p>
  
  <p><strong>IIsWebsite</strong></p>
  
  <pre><code>WEB:         IISWEBSITE
  Description: Default Web Site
  KeyAddress:  IisWebAddress
  Id:          -1
  </code></pre>
  
  <p><strong>IIsWebAddress</strong></p>
  
  <pre><code>Address: IisWebAddress
  Web_:    IISWEBSITE
  Port:    1
  Secure:  0
  </code></pre>
  
  <p>With the above code, the installation is halted with the error message "Website  not found". It appears that IISWEBSITE is never getting set.  Though, I know that "Default Web Site" exists. I know that I must be missing something, but what?</p>
  
  <p>How can I perform a simple check for the existence of a website in IIS 7?</p>