msbuild copy

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="">
<CloudArtifacts Include=".Cloud\Data\**\*.*"/>
<Target Name="CopyFiles">
<Copy SourceFiles="@(CloudArtifacts)" DestinationFiles="@(CloudArtifacts->'c:\PackableFiles\%(RecursiveDir)%(Filename)%(Extension)')" />

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: Logo

You are commenting using your 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