Copy directory recursively task in MSBuild

So I ran into a situation where I needed to copy a directory to a specific destination through MSBuild.

This is how I could achieve my goal.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<CloudArtifacts Include=".Cloud\Data\**\*.*"/>
</ItemGroup>
<Target Name="CopyFiles">
<Copy SourceFiles="@(CloudArtifacts)" DestinationFiles="@(CloudArtifacts->'c:\PackableFiles\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
</Project>

We can get more details on MS Build Copy task in this link. 

🙂

One thought on “Copy directory recursively task in MSBuild

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s