Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

msbuild fails with successful robocopy exit code

My msbuild script fails even if copying files is successful. If robocopy command exitcode < 8, it means that files copied. So how can I say to msbuild script IgnoreExitCode if exit code < 8? I set IgnoreExitCode to true, but what if it's real error?

<Exec Command="robocopy  $(SourceDir) $(DestinationDir) /mir /mt /xd $(ExcludeDir)" IgnoreExitCode="true" />
like image 575
zampotex Avatar asked Sep 30 '16 15:09

zampotex


1 Answers

Use ExitCode output parameter of Exec task and ContinueOnError parameter instead of IgnoreExitCode:

<Exec ContinueOnError="True" Command="robocopy  $(SourceDir) $(DestinationDir) /mir /mt /xd $(ExcludeDir)">
   <Output TaskParameter="ExitCode" PropertyName="ErrorCode"/>
</Exec>
<Error Condition="$(ErrorCode) &gt; 8" Message="Robocopy failed"/>
like image 119
Nikerboker Avatar answered Sep 23 '22 14:09

Nikerboker