|
2 | 2 | title: "ItemDefinitionGroup Element (MSBuild) | Microsoft Docs"
|
3 | 3 | ms.date: "03/13/2017"
|
4 | 4 | ms.topic: "reference"
|
5 |
| -f1_keywords: |
| 5 | +f1_keywords: |
6 | 6 | - "http://schemas.microsoft.com/developer/msbuild/2003#ItemDefinitionGroup"
|
7 |
| -dev_langs: |
| 7 | +dev_langs: |
8 | 8 | - "VB"
|
9 | 9 | - "CSharp"
|
10 | 10 | - "C++"
|
11 | 11 | - "jsharp"
|
12 |
| -helpviewer_keywords: |
| 12 | +helpviewer_keywords: |
13 | 13 | - "ItemDefinitionGroup Element [MSBuild]"
|
14 | 14 | - "<ItemDefinitionGroup> Element [MSBuild]"
|
15 | 15 | ms.assetid: 4e9fb04b-5148-4ae5-a394-42861dd62371
|
16 | 16 | author: mikejo5000
|
17 | 17 | ms.author: mikejo
|
18 | 18 | manager: jillfra
|
19 |
| -ms.workload: |
| 19 | +ms.workload: |
20 | 20 | - "multiple"
|
21 | 21 | ---
|
22 | 22 | # ItemDefinitionGroup element (MSBuild)
|
23 |
| -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](../msbuild/createitem-task.md) and the [CreateProperty task](../msbuild/createproperty-task.md). For more information, see [Item definitions](../msbuild/item-definitions.md). |
| 23 | +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](../msbuild/createitem-task.md) and the [CreateProperty task](../msbuild/createproperty-task.md). For more information, see [Item definitions](../msbuild/item-definitions.md). |
24 | 24 |
|
25 |
| - \<Project> |
26 |
| - \<ItemDefinitionGroup> |
| 25 | +\<Project> |
| 26 | +\<ItemDefinitionGroup> |
27 | 27 |
|
28 |
| -## Syntax |
| 28 | +## Syntax |
29 | 29 |
|
30 |
| -```xml |
31 |
| -<ItemDefinitionGroup Condition="'String A' == 'String B'"> |
32 |
| - <Item1>... </Item1> |
33 |
| - <Item2>... </Item2> |
34 |
| -</ItemDefinitionGroup> |
35 |
| -``` |
| 30 | +```xml |
| 31 | +<ItemDefinitionGroup Condition="'String A' == 'String B'"> |
| 32 | + <Item1>... </Item1> |
| 33 | + <Item2>... </Item2> |
| 34 | +</ItemDefinitionGroup> |
| 35 | +``` |
36 | 36 |
|
37 |
| -## Attributes and elements |
38 |
| - The following sections describe attributes, child elements, and parent elements. |
| 37 | +## Attributes and elements |
| 38 | +The following sections describe attributes, child elements, and parent elements. |
39 | 39 |
|
40 |
| -### Attributes |
| 40 | +### Attributes |
41 | 41 |
|
42 |
| -|Attribute|Description| |
43 |
| -|---------------|-----------------| |
44 |
| -|`Condition`|Optional attribute. Condition to be evaluated. For more information, see [Conditions](../msbuild/msbuild-conditions.md).| |
| 42 | +|Attribute|Description| |
| 43 | +|---------------|-----------------| |
| 44 | +|`Condition`|Optional attribute. Condition to be evaluated. For more information, see [Conditions](../msbuild/msbuild-conditions.md).| |
45 | 45 |
|
46 |
| -### Child elements |
| 46 | +### Child elements |
47 | 47 |
|
48 |
| -|Element|Description| |
49 |
| -|-------------|-----------------| |
50 |
| -|[Item](../msbuild/item-element-msbuild.md)|Defines the inputs for the build process. There may be zero or more `Item` elements in an `ItemDefinitionGroup`.| |
| 48 | +|Element|Description| |
| 49 | +|-------------|-----------------| |
| 50 | +|[Item](../msbuild/item-element-msbuild.md)|Defines the inputs for the build process. There may be zero or more `Item` elements in an `ItemDefinitionGroup`.| |
51 | 51 |
|
52 |
| -### Parent elements |
| 52 | +### Parent elements |
53 | 53 |
|
54 | 54 | | Element | Description |
|
55 | 55 | | - | - |
|
56 | 56 | | [Project](../msbuild/project-element-msbuild.md) | Required root element of an [!INCLUDE[vstecmsbuild](../extensibility/internals/includes/vstecmsbuild_md.md)] project file. |
|
57 | 57 |
|
58 |
| -## Example |
59 |
| - 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". |
| 58 | +## Example |
| 59 | +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". |
60 | 60 |
|
61 |
| -```xml |
62 |
| -<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
63 |
| - <ItemDefinitionGroup> |
64 |
| - <i> |
65 |
| - <m>m1</m> |
66 |
| - <n>n1</n> |
67 |
| - </i> |
68 |
| - </ItemDefinitionGroup> |
69 |
| - <ItemGroup> |
70 |
| - <i Include="a"> |
71 |
| - <o>o1</o> |
72 |
| - <n>n2</n> |
73 |
| - </i> |
74 |
| - </ItemGroup> |
75 |
| - ... |
76 |
| -</Project> |
77 |
| -``` |
| 61 | +```xml |
| 62 | +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 63 | + <ItemDefinitionGroup> |
| 64 | + <i> |
| 65 | + <m>m1</m> |
| 66 | + <n>n1</n> |
| 67 | + </i> |
| 68 | + </ItemDefinitionGroup> |
| 69 | + <ItemGroup> |
| 70 | + <i Include="a"> |
| 71 | + <o>o1</o> |
| 72 | + <n>n2</n> |
| 73 | + </i> |
| 74 | + </ItemGroup> |
| 75 | + ... |
| 76 | +</Project> |
| 77 | +``` |
78 | 78 |
|
79 |
| -## See also |
80 |
| - [Project file schema reference](../msbuild/msbuild-project-file-schema-reference.md) |
81 |
| - [Items](../msbuild/msbuild-items.md) |
| 79 | +## See also |
| 80 | +[Project file schema reference](../msbuild/msbuild-project-file-schema-reference.md) |
| 81 | +[Items](../msbuild/msbuild-items.md) |
0 commit comments