|
1 | 1 | ---
|
2 | 2 | title: Call item functions from MSBuild code
|
3 | 3 | description: Explore how MSBuild code in tasks and targets can call item functions to get information about the items in the project.
|
4 |
| -ms.date: 2/7/2025 |
| 4 | +ms.date: 7/2/2025 |
5 | 5 | ms.topic: how-to
|
6 | 6 | helpviewer_keywords:
|
7 | 7 | - msbuild, Item functions
|
@@ -57,11 +57,11 @@ The table below lists the intrinsic functions available for items.
|
57 | 57 | |`Exists`|`@(MyItems->Exists())`|Filters a set of items to those that actually exist on disk.|
|
58 | 58 | |`GetPathsOfAllDirectoriesAbove`| `@(MyItems->GetPathsOfAllFilesAbove())`|Given a set of items, returns items representing all the ancestor directories. No order is guaranteed.|
|
59 | 59 | |`Reverse`|`@(MyItems->Reverse())`|Returns the items in reverse order.|
|
60 |
| -|`AnyHaveMetadataValue`|`@(MyItems->AnyHaveMetadataValue("MetadataName", "MetadataValue"))` | Returns a `boolean` to indicate whether any item has the given metadata name and value. The comparison is case insensitive. | |
| 60 | +|`AnyHaveMetadataValue`|`@(MyItems->AnyHaveMetadataValue('MetadataName', 'MetadataValue'))` | Returns a `boolean` to indicate whether any item has the given metadata name and value. The comparison is case insensitive. | |
61 | 61 | |`ClearMetadata`|`@(MyItems->ClearMetadata())` |Returns items with their metadata cleared. Only the `itemspec` is retained.|
|
62 |
| -|`HasMetadata`|`@(MyItems->HasMetadata("MetadataName"))`|Returns items that have the given metadata name. The comparison is case insensitive.| |
63 |
| -|`Metadata`|`@(MyItems->Metadata("MetadataName"))`|Returns the values of the metadata that have the metadata name. The items returned have the same metadata as the source values.| |
64 |
| -|`WithMetadataValue`|`@(MyItems->WithMetadataValue("MetadataName", "MetadataValue"))`|Returns items that have the given metadata name and value. The comparison is case insensitive.| |
| 62 | +|`HasMetadata`|`@(MyItems->HasMetadata('MetadataName'))`|Returns items that have the given metadata name. The comparison is case insensitive.| |
| 63 | +|`Metadata`|`@(MyItems->Metadata('MetadataName'))`|Returns the values of the metadata that have the metadata name. The items returned have the same metadata as the source values.| |
| 64 | +|`WithMetadataValue`|`@(MyItems->WithMetadataValue('MetadataName', 'MetadataValue'))`|Returns items that have the given metadata name and value. The comparison is case insensitive.| |
65 | 65 |
|
66 | 66 | > [!NOTE]
|
67 | 67 | > `Exists` can also be used in other contexts; in [MSBuild conditions](msbuild-conditions.md), for example `Condition="Exists('path')"`; or in [Static property functions](property-functions.md), for example `$([System.IO.File]::Exists("path"))`.
|
|
0 commit comments