ItemGroup Element (MSBuild)
Note
This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here
Contains a set of user-defined Item elements. Every item used in a MSBuild project must be specified as a child of an ItemGroup
element.
<Project>
<ItemGroup>
<ItemGroup Condition="'String A' == 'String B'">
<Item1>... </Item1>
<Item2>... </Item2>
</ItemGroup>
The following sections describe attributes, child elements, and parent elements.
Attribute | Description |
---|---|
Condition |
Optional attribute. Condition to be evaluated. For more information, see Conditions. |
Element | Description |
---|---|
Item | Defines the inputs for the build process. There may be zero or more Item elements in an ItemGroup . |
Element | Description |
---|---|
Project | Required root element of an MSBuild project file. |
Target | Starting with .NET Framework 3.5, the ItemGroup element can appear inside a Target element. For more information, see Targets. |
The following code example shows the user-defined item collections Res
and CodeFiles
declared inside of an ItemGroup
element. Each of the items in the Res
item collection contains a user-defined child ItemMetadata element.
<Project xmlns="https://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Res Include = "Strings.fr.resources" >
<Culture>fr</Culture>
</Res>
<Res Include = "Dialogs.fr.resources" >
<Culture>fr</Culture>
</Res>
<CodeFiles Include="**\*.cs" Exclude="**\generated\*.cs" />
<CodeFiles Include="..\..\Resources\Constants.cs" />
</ItemGroup>
...
</Project>
Project File Schema Reference
Items
Common MSBuild Project Items