Skip to content

Error in documentation regarding ItemDefinitionGroup metadata #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions docs/msbuild/item-definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,28 @@ translation.priority.ht:
<test>
<yes>1</yes>
</test>
<i>
<i>
<m>m0</m>
<m Condition="'%(test.yes)'=='1'">m1</m>
</i>
</ItemDefinitionGroup>

```

In this example, item "i" references item "test" in the Condition.
In the above example, item "i" references item "test" in its Condition. This Condition will never be true because MSBuild interprets a reference to another item's metadata in an ItemDefinitionGroup as the empty string. Therefore, "m" would be set to "m0."

```
<ItemDefinitionGroup>
<i>
<m>m0</m>
<yes>1</yes>
<m Condition="'%(i.yes)'=='1'">m1</m>
</i>
</ItemDefinitionGroup>

```

In the above example, "m" would be set to the value "m1" as the Condition references item "i"'s metadata value for item "yes."

## Overriding and Deleting Metadata
Metadata defined in an ItemDefinitionGroup element can be overridden in a later ItemDefinitionGroup element by setting the metadata value to blank. You can also effectively delete a metadata item by setting it to an empty value. For example:
Expand Down Expand Up @@ -250,4 +265,4 @@ translation.priority.ht:
```

## See Also
[Batching](../msbuild/msbuild-batching.md)
[Batching](../msbuild/msbuild-batching.md)