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 /t:ShowIterations

As you can see, MSBuild correctly shows the list of numbers and collections they belong to, as represented in Figure 51.3.

Figure 51.3 Demonstrating batching technique with MSBuild.

image

Thus with batching you can run the same target over all items within a group in a simple way.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.64.94