title: Visual Studio pre-build event; Checking exit code for each event
body: <p>I have a solution with multiple projects. One project only needs to build if both two events, in the pre-build event, exit with error code 0.</p>
  
  <p>So I thought I could do the following:</p>
  
  <blockquote>
    <p>"C:\Path\To\Binary1.exe" &amp; "C:\path\to\binary2.exe"</p>
  </blockquote>
  
  <p>In my test scenario something goes wrong so Binary1.exe exits with a non-zero value. But visual studio goes on building the project anyway. 
  When I run the pre-build event commandline in cmd and echo %errorlevel% I see the exit code being non-zero.</p>
  
  <p>When I only put </p>
  
  <blockquote>
    <p>"C:\Path\To\Binary1.exe"</p>
  </blockquote>
  
  <p>in the pre-build event, the build is stopped and en error is shown in the <code>Error List</code> window of Visual Studio.</p>
  
  <p>I am definitely sure that Binary1.exe is exiting with a non-zero value as its also shows a messagebox prior to exit.</p>
  
  <p>I can think of one solution. Binary1.exe calling Binary2.exe and exiting with a non-zero exit code when Binary2.exe exits with a non-zero exit code. But that is not really a flexible solution.</p>
  
  <p><strong>To summarize:</strong>
  How can I run multiple pre-build events and stop buidling when one of the commands returns a non-zero value?</p>