3

I have a script snippet looks like below:

<ItemGroup>
  <files Include="*.txt"></files>
</ItemGroup>
<Message Text="@(files)">

<ItemGroup>
  <files Include="*.xml"></files>
</ItemGroup>
<Message Text="@(files)">

I want that in the second Message output, only *.xml is printed. Currently both of *.txt and *.xml are printed which is what I don't want to.

So, my question is how can we overwrite the item files in the second print script? Please help!

Nam G VU
  • 33,193
  • 69
  • 233
  • 372
  • possible duplicate of [Modify MSBuild ItemGroup Metadata](http://stackoverflow.com/questions/841913/modify-msbuild-itemgroup-metadata) – Michal Hosala May 15 '15 at 08:39

1 Answers1

4

I find out a way to do it but I don't like it very much:

<ItemGroup>
  <files Include="*.txt"></files>
</ItemGroup>
<Message Text="@(files)">

<ItemGroup>
  <files Remove="@(files)"></files>
  <files Include="*.xml"></files>
</ItemGroup>
<Message Text="@(files)">
Nam G VU
  • 33,193
  • 69
  • 233
  • 372