RoboCopy Class

MSBuild Extension Pack

RoboCopy Class MSBuild Extension Pack Help 4.0.12.0
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
Inheritance Hierarchy

SystemObject  Microsoft.Build.UtilitiesTask
    Microsoft.Build.UtilitiesToolTask
      MSBuild.ExtensionPack.FileSystemRoboCopy

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

The RoboCopy type exposes the following members.

Constructors

  NameDescription
Public methodRoboCopy
Top
Properties

  NameDescription
Public propertyDestination
Destination Dir (drive:\path or \\server\share\path).
Public propertyFiles
File(s) to copy (names/wildcards: default is "*.*").
Public propertyLogToConsole
Set to true to log output to the console. Default is false
Public propertyOptions
Type 'robocopy.exe /?' at the command prompt for all available options
Public propertyReturnCode
Gets the Return Code from RoboCopy
Public propertySource
Source Directory (drive:\path or \\server\share\path).
Top
Examples

<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>
See Also

Reference