I have the following msbuild script that copies the entire DeploymentDirectory to the VersionSpecificDirectory. Here is the snippet:
<CreateItem Include="$(DeploymentDirectory)/**/*.*" > <Output ItemName="AllDeploymentFilesToCopy" TaskParameter="Include" /> </CreateItem> <Copy SourceFiles="@(AllDeploymentFilesToCopy)" DestinationFiles="@(AllDeploymentFilesToCopy->'$(VersionSpecificDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
What would the script be for copying all the files in the DeploymentDirectory instead of the directory itself?
Update: I tried changing the direction of the slash to be a backward slash and the problem still exists.
Another Update: This was unrelated to the msbuild code. Both the code in my question and the code in the answer works fine for doing this.
Type "xcopy", "source", "destination" /t /e in the Command Prompt window. Instead of “ source ,” type the path of the folder hierarchy you want to copy. Instead of “ destination ,” enter the path where you want to store the copied folder structure. Press “Enter” on your keyboard.
Use the cp command to create a copy of the contents of the file or directory specified by the SourceFile or SourceDirectory parameters into the file or directory specified by the TargetFile or TargetDirectory parameters.
Try this:
<ItemGroup> <MySourceFiles Include="c:\MySourceTree\**\*.*"/> </ItemGroup> <Target Name="CopyFiles"> <Copy SourceFiles="@(MySourceFiles)" DestinationFiles="@(MySourceFiles->'c:\MyDestinationTree\%(RecursiveDir)%(Filename)%(Extension)')" /> </Target>
From MSDN.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With