Skip to content

MSB4259 in VS 18.5 Insiders / newer MSBuild: invalid property reference whitespace in Google.Protobuf.Tools.props (Grpc.Tools 2.76.0) #41548

@colincmac

Description

@colincmac

What version of gRPC and what language are you using?

.NET 10 (C#)
Grpc.Tools v2.76.0

What operating system (Linux, Windows,...) and version?

Windows & Linux

What runtime / compiler are you using (e.g. python version or version of gcc)

What did you do?

  1. Install the latest Visual Studio (18.5 preview) or the latest MSBuild (v18.02) or any recent change from this PR Whitespace in property names not issuing error dotnet/msbuild#12352
  2. Try opening this solution https://github.com/colincmac/grpc-tools-msbuild-whitespace-issue

What did you expect to see?

Protos generated.

What did you see instead?

Unexpected space at position "3" of property reference "$( [System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)../../tools) )". Did you forget to remove a space? C:\Users<username>.nuget\packages\grpc.tools\2.76.0\build_protobuf\Google.Protobuf.Tools.props

Anything else we should know about your project / environment?

This is related to MSBuild changes here: dotnet/msbuild#13076
With Visual Studio 18.5.0 Insiders (11502.17.main) (which includes newer MSBuild validation), projects that reference Grpc.Tools 2.76.0 can fail to load/build due to MSB4259 being raised from the package’s props file.

MSBuild now errors when a property reference contains leading/trailing whitespace inside $( … ) outside of condition contexts. In Grpc.Tools 2.76.0, the following property reference includes whitespace and triggers the error

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions