dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.23k stars 1.35k forks source link

[Bug]: Specifying -graphBuild twice causes misleading error MSB1057 #10596

Open DalekBaldwin opened 2 months ago

DalekBaldwin commented 2 months ago

Issue Description

For ordinary MSBuild command-line arguments, redundant arguments are accepted (for instance, setting defaults in Directory.Build.rsp and overriding them at the command line). But if -graphBuild is specified more than once, an error occurs.

Steps to Reproduce

dotnet msbuild -t:Build -graphBuild:True -graphBuild:True MyProj.csproj

Expected Behavior

Argument override is accepted.

Actual Behavior

MSBuild version 17.10.4+10fbfbf2e for .NET
MSBUILD : error MSB1057: Graph build value is not valid.
Switch: True

Analysis

No response

Versions & Configurations

dotnet: 8.0.304 MSBuild: 17.10.4.21802

DalekBaldwin commented 2 months ago

Addendum: It seems this occurs only when using an actual argument value argument twice, like -graphBuild:True -graphBuild:True. When using the no-argument variant twice, -graphBuild -graphBuild, no error occurs.