I'm trying to copy a folder recursively to multiple destination folders using MSBuild's Copy task. I've seen the following question which gave me a good start, but I must be missing something:
A snippet from my build file is below:
<ItemGroup>
<DeployPath Include="\\server1\path" />
<DeployPath Include="\\server2\path" />
</Item Group>
<Target Name="Deploy">
<Message Text="%(DeployPath.Identity)" />
<Copy SourceFiles="@(ItemsToCopy)" DestinationFolder="%(DeployPath.Identity)\%(RecursiveDir)" />
</Target>
When I run this, the "Message" task, as I would expect, spits out 2 lines:
\\server1\path
\\server2\path
The problem is, the "Copy" task appears to only run once, and copies the files to the root of the current hard drive and not the specified network paths:
Copies to C:\file1.txt
instead of \\server1\path\file1.txt
I'm fairly new to MSBuild, so I feel like I'm missing something pretty basic here.
Any help would be greatly appreciated.