tags:

views:

576

answers:

1

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.

+5  A: 

Try this:

<ItemGroup>
    <MySourceFiles Include="c:\MySourceTree\**\*.*"/>
</ItemGroup>

<Target Name="CopyFiles">
    <Copy
        SourceFiles="@(MySourceFiles)"
        DestinationFiles="@(MySourceFiles->'c:\MyDestinationTree\%(RecursiveDir)%(Filename)%(Extension)')"
    />
</Target>

From MSDN.

Matt Hanson