title: WIX check if file exists while installing
body: <p>I'm having a problem with my WIX installer. I want to check if a special file exists and if, it should be installed, else not. So currently I'm doing a file search:</p>
  
  <pre><code>&lt;Property Id="FileExists"&gt;
    &lt;DirectorySearch Id="CheckFileDir" Path="..." Depth="0"&gt;
      &lt;FileSearch Id="CheckFile" Name="Some.dll"/&gt;
    &lt;/DirectorySearch&gt;
  &lt;/Property&gt;
  </code></pre>
  
  <p>And set the feature level to null if it does not exist:</p>
  
  <pre><code>&lt;Feature Id="Feature_1" Title="Feature_1" Level="1"&gt;
    &lt;ComponentRef Id="ComponentId"/&gt;
    &lt;Condition Level="0"&gt;NOT FileExists&lt;/Condition&gt;
  &lt;/Feature&gt;
  </code></pre>
  
  <p>But how must my component look like?</p>
  
  <pre><code>&lt;Component Id="ComponentID" Directory="Direc" KeyPath="yes" Guid="GUID_FD6FB7A51317" &gt;
    &lt;File Id="FileId" Name="file.dll" Source="$(var.accessPath)access.dll" Vital="no"/&gt;
  &lt;/Component&gt;
  </code></pre>
  
  <p>If I do so I get the error message that the file "$(var.accessPath)access.dll" could not be found.</p>
  
  <p>Edit 1: accessPath is defined as:</p>
  
  <pre><code>&lt;?define accessPath="%Variable%\bin\"?&gt;
  </code></pre>
  
  <p>I'm very grateful for every help!</p>
  
  <p>Hendrik</p>