Skip to content

Latest commit

 

History

History
85 lines (68 loc) · 2.57 KB

itemdefinitiongroup-element-msbuild.md

File metadata and controls

85 lines (68 loc) · 2.57 KB
title ms.date ms.topic f1_keywords dev_langs helpviewer_keywords ms.assetid author ms.author manager ms.workload
ItemDefinitionGroup Element (MSBuild) | Microsoft Docs
03/13/2017
reference
VB
CSharp
C++
jsharp
ItemDefinitionGroup Element [MSBuild]
<ItemDefinitionGroup> Element [MSBuild]
4e9fb04b-5148-4ae5-a394-42861dd62371
ghogen
ghogen
jillfra
multiple

ItemDefinitionGroup element (MSBuild)

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.

<Project> <ItemDefinitionGroup>

Syntax

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

Attributes and elements

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

Attributes

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.

Example

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="http://schemas.microsoft.com/developer/msbuild/2003">
    <ItemDefinitionGroup>
        <i>
            <m>m1</m>
            <n>n1</n>
        </i>
    </ItemDefinitionGroup>
    <ItemGroup>
        <i Include="a">
            <o>o1</o>
            <n>n2</n>
        </i>
    </ItemGroup>
    ...
</Project>

See also