Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article describes the MSB4248 error code.
Message text
MSB4248: Cannot expand metadata in expression 'value'.
Remarks
The MSB4248 error occurs when MSBuild is unable to expand item metadata in a build operation. This situation typically happens when metadata references are used in an invalid context or when the metadata being referenced doesn't exist for the item. For example, the built-in metadata for SomeItem->%(Extension)
was used, but the item isn't a file.
This error can also occur when file paths exceed the maximum path length. If you use long paths, check the Windows operating system LongPathsEnabled
setting. For more information, see Maximum file path limitation.
Resolution
Validate that the requested metadata is consistent with the item.
Conditionally access metadata
For dynamic builds, ensure metadata is accessed conditionally to avoid referencing undefined metadata:
<Message Text="Target Framework: %(Metadataname)" Condition="'%(Metadataname)' != ''" />
Enable long paths on the Windows operating system.
Applies to
All versions of MSBuild