How do I selectively perform certain responses tasks or targets based on item properties #7524
-
Let's say we have: <ItemGroup>
<MySpec Include="Alpha" Type="Module" ... />
<MySpec Include="Bravo" Type="Feature" ... />
<MySpec Include="Charlie" Type="Feature" ... />
<MySpec Include="Delta" Type="Theme" ... />
<MySpec Include="Echo" Type="Theme" ... />
<MySpec Include="Foxtrot" Type="SomethingElse" ... />
</ItemGroup> My goal there, if possible, is to filter on all And while it would be 'simple enough' to add specialized item lists, I would like to avoid that if at all possible, and simply support a single variant style shape. I think that the solution must probably involve some sort of copying from one source items list to another, using a condition, predicate, or what have you, but the tasks, inputs, outputs, etc, are a bit unfamiliar to me. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
For instance, |
Beta Was this translation helpful? Give feedback.
-
It sounds like you are asking about how to do batching. Here is an example of task batching using your example data:
The output will be:
MSBuild is declarative. There are no loops. Don't think of Targets and Tasks as function calls. In the example, the first four The conditions on each In many cases it is fine to perform a task multiple times with different batches. For the times when that is not acceptable, batching can be used to create a new item group collection. The |
Beta Was this translation helpful? Give feedback.
It sounds like you are asking about how to do batching.
Here is an example of task batching using your example data: