I banged my head on this one for a little bit but then finally found the answer here. You sometimes find yourself in a situation where you would like “batch” items from an ItemGroup. To do so you simply need to set your Target’s Outputs attribute to contain the identity of the item. This will execute the entire target once per item in the group.
Example:
<ItemGroup>
<TestItem Include="test A" />
<TestItem Include="test B" />
<TestItem Include="test C" />
</ItemGroup>
<Target Name="Build" Outputs="%(TestItem.Identity)">
<Message Text="%(TestItem.Identity)" />
</Target>
Enjoy!