views:

84

answers:

1

I'm trying to exclude a series of files from a custom deployment step in my TFS 2008 build definition. I want to include all files except those starting with either P0 or P1. Here are some of my attempts...

<ItemGroup>
  <FilesToCopy Include="$(BinariesRoot)\Debug\*.*" Exclude="$(BinariesRoot)\Debug\P0*.*;$(BinariesRoot)\Debug\P1*.*" />
</ItemGroup>

and

<PropertyGroup>
  <FilesToExclude>$(BinariesRoot)\Debug\P0*.*;$(BinariesRoot)\Debug\P1*.*</FilesToExclude>
</PropertyGroup>
<ItemGroup>
  <FilesToCopy Include="$(BinariesRoot)\Debug\*.*" Exclude="$(FilesToExclude)" />
</ItemGroup>

and

<PropertyGroup>
  <FilesToExclude>$(BinariesRoot)\Debug\P0*.*;$(BinariesRoot)\Debug\P1*.*</FilesToExclude>
</PropertyGroup>
<ItemGroup>
  <FilesToCopy Include="$(BinariesRoot)\Debug\*.*" Exclude="@(FilesToExclude)" />
</ItemGroup>

When I come to copy the files using this...

<Copy SourceFiles="@(FilesToCopy)" DestinationFolder="T:\Deployment\" />

... it always copies all files (i.e. doesn't exclude the P0 and P1 files).

A: 

Run your build with diagnostic output MSBuild ... /clp:v=diag and see the values of your Items. You can also simply add a step to output the list of files like this:

<Message Text="SrcFiles: @(FilesToCopy)" />

Looking at your example above, the second snippet is correct and the third is not (reference to a Property is done via $ not via @)

mfloryan