MSBuild Well-known Item Metadata
The following table describes the metadata assigned to every item upon creation. In each example, the following item declaration was used to include the file C:\MyProject\Source\Program.cs
in the project.
<ItemGroup>
<MyItem Include="Source\Program.cs" />
</ItemGroup>
Item Metadata | Description |
---|---|
%(FullPath) |
Contains the full path of the item. For example:
|
%(RootDir) |
Contains the root directory of the item. For example:
|
%(Filename) |
Contains the file name of the item, without the extension. For example:
|
%(Extension) |
Contains the file name extension of the item. For example:
|
%(RelativeDir) |
Contains the path specified in the Include attribute, up to the final backslash (\). For example:
|
%(Directory) |
Contains the directory of the item, without the root directory. For example:
|
%(RecursiveDir) |
If the Include attribute contains the wildcard **, this metadata specifies the path to the file, beginning at the location of the wildcard. For more information on wildcards, see How To: Use Wildcards to Build All Files in a Directory. This example has no RecursiveDir metadata, but if the following example was used to include this item, the item would contain a RecursiveDir value of
If the following example was used to include this item, the RecursiveDir value of the item would remain
|
%(Identity) |
The item specified in the Include attribute.. For example:
|
%(ModifiedTime) |
Contains the timestamp from the last time the item was modified. For example:
|
%(CreatedTime) |
Contains the timestamp from when the item was created. For example:
|
%(AccessedTime) |
Contains the timestamp from the last time the time was accessed.
|
See Also
Concepts
MSBuild Items
MSBuild Batching