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" />
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) > 8" Message="Robocopy failed"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With