Batching

The batching feature in MSBuild simply enables you to perform a kind of For..Each loop over items within an ItemGroup section. Imagine you have two collections of items within an ItemGroup section, where for each item a value is specified. For a better understanding, create a new Xml file named MSBuildDemo.proj and type the following code:

image

The goal of the new target is iterating all items in both collections and associating each number to the appropriate item; in other words, the goal is to display what items in both collections the number 1 is associated to and so on for other numbers. Now type the following command line:

MSBuild MsBuildDemo.proj ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.