How to rewrite ItemGroup (for example, what we do with PropertyGroup)

I have a script fragment as shown below:

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

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

I want the second message to output only * .xml. Currently, both * .txt and * .xml files are printed, which I do not want.

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

+3
source share
1 answer

I will figure out how to do this, but I really dislike it:

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

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

Source: https://habr.com/ru/post/1737317/


All Articles