Copy all files and folders using msbuild

I was searching help on this too. It took me a while, but here is what I did that worked really well.

<Target Name="AfterBuild">
    <ItemGroup>
        <ANTLR Include="..\Data\antlrcs\**\*.*" />
    </ItemGroup>
    <Copy SourceFiles="@(ANTLR)" DestinationFolder="$(TargetDir)\%(RecursiveDir)" SkipUnchangedFiles="true" />
</Target>

This recursively copied the contents of the folder named antlrcs to the $(TargetDir).

Leave a Comment