MSB4096: The item 'item' in item list 'item-list' does not define a value for metadata 'name'
The full error message resembles the following example:
MSB4096: The item 'item' in item list 'item-list' does not define a value for metadata 'name'. In order to use this metadata, either qualify it by specifying %(item-name.metadata-name), or ensure that all items in this list define a value for this metadata.
This error occurs when your MSBuild script uses a shorthand unqualified syntax for referencing item metadata %(MetadataName)
, without fully qualifying it with the Item name, as in %(ItemName.MetadataName)
. The error text suggests qualifying the metadata by prefixing the metadata name with the Item name. For example, %(File.Extension)
rather than just %(Extension)
.
You can also avoid this error by ensuring that all items of the given type define a value for the metadata.
See Item metadata.