Edit

Share via


MSB4099 diagnostic code

This article describes the MSB4099 error code.

Message text

MSB4099: A reference to an item list at position 'value' is not allowed in this condition 'value'.

This error occurs when a project is using an item in a condition in a context where it's not yet available for use. MSBuild evaluates a project file using multiple passes. Import elements, top-level PropertyGroup elements, and their Property elements are evaluated before items are evaluated. As a result, items are unavailable at the point when those elements are evaluated. Therefore, you can't use items in conditions in any of those elements. See How MSBuild builds projects.

To fix this issue, restructure your logic to avoid the need to reference an item in a condition in an Import element, PropertyGroup element, or Property element at the top level.

Applies to

All versions of MSBuild