This task wraps RoboCopy. Successful non-zero exit codes from Robocopy are set to zero to not break MSBuild. Use the ReturnCode property to access the exit code from Robocopy

Namespace: MSBuild.ExtensionPack.FileSystem
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0

Examples

CopyXML
<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
        <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
    </PropertyGroup>
    <Import Project="$(TPath)"/>
    <Target Name="Default">
        <MSBuild.ExtensionPack.FileSystem.RoboCopy Source="C:\b" Destination="C:\bbzz" Files="*.*" Options="/MIR">
            <Output TaskParameter="ExitCode" PropertyName="Exit" />
            <Output TaskParameter="ReturnCode" PropertyName="Return" />
        </MSBuild.ExtensionPack.FileSystem.RoboCopy>
        <Message Text="ExitCode = $(Exit)"/>
        <Message Text="ReturnCode = $(Return)"/>
        <MSBuild.ExtensionPack.FileSystem.RoboCopy Source="C:\a" Destination="C:\abzz" Files="*.txt" Options="/e">
            <Output TaskParameter="ExitCode" PropertyName="Exit" />
            <Output TaskParameter="ReturnCode" PropertyName="Return" />
        </MSBuild.ExtensionPack.FileSystem.RoboCopy>
        <Message Text="ExitCode = $(Exit)"/>
        <Message Text="ReturnCode = $(Return)"/>
    </Target>
</Project>

Inheritance Hierarchy

System..::..Object
  Microsoft.Build.Utilities..::..Task
    Microsoft.Build.Utilities..::..ToolTask
      MSBuild.ExtensionPack.FileSystem..::..RoboCopy

See Also