Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet build and friends mangle invalid property specifications #37230

Open
rainersigwald opened this issue Nov 29, 2023 · 5 comments
Open

dotnet build and friends mangle invalid property specifications #37230

rainersigwald opened this issue Nov 29, 2023 · 5 comments
Labels
Milestone

Comments

@rainersigwald
Copy link
Member

rainersigwald commented Nov 29, 2023

Originally filed as dotnet/msbuild#9475 by @Forgind. There is a bug in MSBuild but it's exacerbated by a CLI behavior.

Issue Description

Specifying /p:Property:value instead of /p:Property=value leads to an aborted build when using dotnet build.

Steps to Reproduce

> dotnet new console
> dotnet build <csproj name> /p:UseRidGraph:false

Expected Behavior

One line for the MSBuild version followed by a line specifying that the property is not valid (MSB1006) then telling me which exactly was wrong like:
MSBuild version 17.9.0-dev-23579-01+5fcddc790 for .NET Framework
MSBUILD : error MSB1006: Property is not valid.
Switch: UseRidGraph:false

For switch syntax, type "MSBuild -help"

Actual Behavior

It just told me the version with no errors:
MSBuild version 17.8.3+195e7f5a3 for .NET

Analysis

I tried this with MSBuild.exe (from main, not 17.8.3), and it worked as expected. I tried dotnet MSBuild.dll with the MSBuild freshly built from main, and it worked as expected. I tried using MSBuild.exe from my VS preview (version 17.9.0-preview-23574-01+7b37a280a), and this bug still didn't reproduce. Then I built MSBuild main and used the deploy script to overwrite my 8.0.100 SDK, and this bug finally reproduced.

That means this may be Core-specific (a CLI bug?) or it may be specific to some component that MSBuild does not overwrite with the deploy script. Of note, it does still print out the version, which (I think) means MSBuild knows it's supposed to be executing and tries to execute but ultimately fails without logging anything further.

Versions & Configurations

8.0.100 SDK with MSBuild version above.

@rainersigwald
Copy link
Member Author

Something in CLI argument parsing is seeing

/p:UseRidGraph:false

and substituting in

--property:UseRidGraph:false=

which exposes the user to dotnet/msbuild#9475.

@baronfel
Copy link
Member

It's probably a bug in our version of the property parser here.

@Forgind Forgind removed the untriaged Request triage from a team member label Dec 5, 2023
@Forgind Forgind removed their assignment Dec 5, 2023
@Forgind Forgind added this to the Backlog milestone Dec 5, 2023
@ShreyasJejurkar
Copy link

I just tried the repo steps in the original issue, but I did not get any error.
image

@Forgind
Copy link
Member

Forgind commented Jun 18, 2024

@ShreyasJejurkar, that's successfully reproducing the error. You should have seen error text because /p:UseRidGraph:false is incorrect syntax, but you didn't. That's the bug.

@Forgind Forgind changed the title dotnet build mangles invalid property specifications dotnet build and friends mangle invalid property specifications Jun 18, 2024
@Forgind
Copy link
Member

Forgind commented Jun 18, 2024

Making this a bit more broad because of #38645, which likely is the same issue but for dotnet pack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants