开发者

How to overwrite ItemGroup (like what we do with PropertyGroup)

开发者 https://www.devze.com 2022-12-23 00:06 出处:网络
I have a script snippet looks like below: <ItemGroup> <files Includ开发者_StackOverflow中文版e=\"*.txt\"></files>

I have a script snippet looks like below:

<ItemGroup>
  <files Includ开发者_StackOverflow中文版e="*.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!


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)">
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号