title: How do I cause an error in MSBuild if a file exists?
body: <p>We have a process that runs prior to our nightly builds.  If the process fails it generates a text file.  All I need to do is check to see if the file exists, and if it does, cause a failing MSBuild.</p>
  
  <p>I currently have tried the following:</p>
  
  <pre><code>&lt;CreateProperty Condition="Exists('C:\Process\Fail.txt')"
        Value="false"&gt;
    &lt;Output TaskParameter="Value" PropertyName="ProcessTestPassed"/&gt;
  &lt;/CreateProperty&gt;
  &lt;Message Text="Process did not pass" Condition="Exists('C:\Process\Fail.txt')" ContinueOnError="false" /&gt;
  
  &lt;ReadLinesFromFile File="C:\Process\Fail.txt"                  Condition="'$(ProcessTestPassed)'=='false'" ContinueOnError="false" &gt;
    &lt;Output TaskParameter="Lines" ItemName="FileContents" /&gt;
  &lt;/ReadLinesFromFile&gt;
  &lt;Message Text="FileContents: $(FileContents)"  Condition="'$(ProcessTestPassed)'=='false'" ContinueOnError="false" /&gt;
  </code></pre>
  
  <p>Which gives a passing build with this output:</p>
  
  <pre><code>Task "CreateProperty"
  Done executing task "CreateProperty".
  Task "Message"
    QAWizardProTestPassed did not pass
  Done executing task "Message".
  Task "ReadLinesFromFile"
  Done executing task "ReadLinesFromFile".
  Task "Message"
    FileContents: 
  Done executing task "Message".
  </code></pre>
  
  <p>I know the above is probably overkill, but I just need something working!  What am I missing here?</p>