ItemDefinitionGroup Element (MSBuild)


This article applies to Visual Studio 2015. If you're looking for Visual Studio 2017 documentation, use the version selector at the top left. We recommend upgrading to Visual Studio 2017. Download it here.

The ItemDefinitionGroup element lets you define a set of Item Definitions, which are metadata values that are applied to all items in the project, by default. ItemDefinitionGroup supersedes the need to use the CreateItem Task and the CreateProperty Task. For more information, see Item Definitions.



<ItemGroup Condition="'String A' == 'String B'">  
    <Item1>... </Item1>  
    <Item2>... </Item2>  

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.


Attribute Description
Condition Optional attribute. Condition to be evaluated. For more information, see Conditions.

Child Elements

Element Description
Item Defines the inputs for the build process. There may be zero or more Item elements in an ItemDefinitionGroup.

Parent Elements

Element Description
Project Required root element of an MSBuild project file.


The following code example defines two metadata items, m and n, in an ItemDefinitionGroup. In this example, the default metadata "m" is applied to Item "i" because metadata "m" is not explicitly defined by Item "i". However, default metadata "n" is not applied to Item "i" because metadata "n" is already defined by Item "i".

<Project xmlns="">  
        <i Include="a">  

See Also

Project File Schema Reference