Items

When software is being built, files and directories are used heavily. Because of the usage and importance of files and directories, MSBuild has a specific construct to support these. This construct is items. In the previous section we covered properties. As stated previously, in programming terms properties can be considered a regular scalar variable. This is because a property has a unique name and a single value. An item can be thought of as an array. This is because an item has a single name but can have multiple values. Properties use the PropertyGroup to declare properties; similarly, items use an ItemGroup element. Take a look at the following very simple example from Items01.proj.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> ...

Get Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build 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.