title: InvokeProcess in TFS2010 build doesn't bubble up errors when I run sqlcmd
body: <p>I am using InvokeProcess task to run SqlCmd in order to execute a sql script against the database. However, if there are errors encountered in the sql script, no errors are raised and the build status is not set to false, as per XAML. What could be happening? 
  Here is the code snippet:</p>
  
  <pre><code>&lt;mtbwa:InvokeProcess Arguments="[&amp;quot;-b -S server1\dev -U sa -P password -i &amp;quot;&amp;quot;&amp;quot; + SourcesDirectory + &amp;quot;\DatabaseScripts\conversion.sql&amp;quot;&amp;quot;&amp;quot;]" DisplayName="Run Conversion SQL" FileName="c:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" sap:VirtualizedContainerService.HintSize="464,384" Result="[ExitCode]" WorkingDirectory="[SourcesDirectory]"&gt;
  &lt;mtbwa:InvokeProcess.ErrorDataReceived&gt;
      &lt;ActivityAction x:TypeArguments="x:String"&gt;
          &lt;ActivityAction.Argument&gt;
          &lt;DelegateInArgument x:TypeArguments="x:String" Name="errOutput" /&gt;
          &lt;/ActivityAction.Argument&gt;
          &lt;Sequence sap:VirtualizedContainerService.HintSize="222,208"&gt;
              &lt;sap:WorkflowViewStateService.ViewState&gt;
              &lt;scg:Dictionary x:TypeArguments="x:String, x:Object"&gt;
              &lt;x:Boolean x:Key="IsExpanded"&gt;True&lt;/x:Boolean&gt;
              &lt;/scg:Dictionary&gt;
              &lt;/sap:WorkflowViewStateService.ViewState&gt;
              &lt;mtbwa:WriteBuildError DisplayName="VSDBCMD Error" sap:VirtualizedContainerService.HintSize="200,22" Message="[errOutput]" /&gt;
              &lt;mtbwa:SetBuildProperties DisplayName="Set build to failed" sap:VirtualizedContainerService.HintSize="200,22" PropertiesToSet="Status" Status="[Microsoft.TeamFoundation.Build.Client.BuildStatus.Failed]" /&gt;
          &lt;/Sequence&gt;
      &lt;/ActivityAction&gt;
  &lt;/mtbwa:InvokeProcess.ErrorDataReceived&gt;
  &lt;mtbwa:InvokeProcess.OutputDataReceived&gt;
      &lt;ActivityAction x:TypeArguments="x:String"&gt;
          &lt;ActivityAction.Argument&gt;
          &lt;DelegateInArgument x:TypeArguments="x:String" Name="stdOutput" /&gt;
          &lt;/ActivityAction.Argument&gt;
          &lt;mtbwa:WriteBuildMessage sap:VirtualizedContainerService.HintSize="222,22" Message="[stdOutput]" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" /&gt;
      &lt;/ActivityAction&gt;
  &lt;/mtbwa:InvokeProcess.OutputDataReceived&gt;
  &lt;sap:WorkflowViewStateService.ViewState&gt;
      &lt;scg:Dictionary x:TypeArguments="x:String, x:Object"&gt;
          &lt;x:Boolean x:Key="IsPinned"&gt;False&lt;/x:Boolean&gt;
          &lt;x:Boolean x:Key="IsExpanded"&gt;True&lt;/x:Boolean&gt;
      &lt;/scg:Dictionary&gt;
  &lt;/sap:WorkflowViewStateService.ViewState&gt;
  </code></pre>
  
  <p></p>