Skip to content

MSBuild should error for invalid properties in conditional expression #5615

@danmoseley

Description

@danmoseley

eg

<Project>

  <Target Name="t">
    <Warning Text="should print" Condition="'$(MSBuildProjectFullPath)' != ''"/>
    <Warning Text="should warn on this line" Condition="'$(MSBuildProjectFullPath )' != ''"/>
  </Target>
  
</Project>

prints

C:\proj\test.proj(4,5): warning : should print
C:\proj\test.proj(5,5): warning : should error on this line

The conditional parser should warn for any whitespace or other invalid character in a property name.

Example of actual bug that would have been found: dotnet/sdk#12784

Looks like the code has always been this way:

// Maybe we need to generate an error for invalid characters in property/metadata name?
// For now, just wait and let the property/metadata evaluation handle the error case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wantedIssues that the core team doesn't plan to work on, but would accept a PR for. Comment to claim.triaged

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions