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.17k stars 1.34k forks source link

Error message when defining a property with no value on the command line is confusing #472

Open rainersigwald opened 8 years ago

rainersigwald commented 8 years ago

For example:

o:\msbuild>msbuild /p:blah build.proj /nologo
MSBUILD : error MSB1006: Property is not valid.
Switch: blah

What does Switch: mean? It would be more accurate to say something like "No value was given for property 'blah' defined on the command line."

alexsorokoletov commented 6 years ago

This issue is a little bit incomplete. I came to this issue from here: https://github.com/Microsoft/vsts-tasks/issues/4558. Similar reports https://issues.jenkins-ci.org/browse/JENKINS-5552 and https://teamcity-support.jetbrains.com/hc/en-us/community/posts/206982415-Error-when-inserting-comma-in-build-configuration-name-MSBuild-

Here is my output:

➜  msbuild-tests dotnet new classlib
The template "Class library" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /Users/username/work/dt/msbuild-tests/msbuild-tests.csproj...
  Restoring packages for /Users/username/work/dt/msbuild-tests/msbuild-tests.csproj...
  Generating MSBuild file /Users/username/work/dt/msbuild-tests/obj/msbuild-tests.csproj.nuget.g.props.
  Generating MSBuild file /Users/username/work/dt/msbuild-tests/obj/msbuild-tests.csproj.nuget.g.targets.
  Restore completed in 186.36 ms for /Users/username/work/dt/msbuild-tests/msbuild-tests.csproj.

Restore succeeded.

➜  msbuild-tests msbuild /t:Clean /p:PropertyName=Long, Value
...
MSBUILD : error MSB1005: Specify a property and its value.
Switch: /p:PropertyName=Long,

For switch syntax, type "MSBuild /help"
➜  msbuild-tests msbuild /t:Clean /p:PropertyName="Long, Value"
...
MSBUILD : error MSB1006: Property is not valid.
Switch:  Value

For switch syntax, type "MSBuild /help"
➜  msbuild-tests msbuild /t:Clean "/p:PropertyName=Long, Value"
...
MSBUILD : error MSB1006: Property is not valid.
Switch:  Value

For switch syntax, type "MSBuild /help"
➜  msbuild-tests msbuild /t:Clean '/p:PropertyName=Long, Value'
...
MSBUILD : error MSB1006: Property is not valid.
Switch:  Value

For switch syntax, type "MSBuild /help"
➜  msbuild-tests msbuild /t:Clean '/p:PropertyName="Long, Value"'
Microsoft (R) Build Engine version 15.4.0.0 (master/f296e67b Thu Sep 21 19:38:16 EDT 2017) for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 10/21/2017 10:08:14 AM.

I also have same issue with Xamarin.iOS (same as vsts-tasks team had).

My question is about single quote escaping - is that a universal mechanism that works across all platforms MSBuild supports (Windows, OS X, Unix)? If so, I can go ahead and apply that to the build system we use (F# Fake).

Thank you. P.S. It is so great to have MSBuild repo on github, you can't believe! :) 👍

pronobeshm commented 4 years ago

MSB1005: Specify a property and its value.

Running as SYSTEM [EnvInject] - Loading node environment variables. Building in workspace C:\Program Files (x86)\Jenkins\workspace\First Windows Project No credentials specified

git.exe rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository git.exe config remote.origin.url https://github.com/pronobeshm/PdftoWord.git # timeout=10 Fetching upstream changes from https://github.com/pronobeshm/PdftoWord.git git.exe --version # timeout=10 git.exe fetch --tags --force --progress -- https://github.com/pronobeshm/PdftoWord.git +refs/heads/:refs/remotes/origin/ # timeout=10 git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10 git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10 Checking out Revision b41ae8f43b6760d2da87091f907d2640ff42db6b (refs/remotes/origin/master) git.exe config core.sparsecheckout # timeout=10 git.exe checkout -f b41ae8f43b6760d2da87091f907d2640ff42db6b # timeout=10 Commit message: "This is my First Commit to the Github" git.exe rev-list --no-walk b41ae8f43b6760d2da87091f907d2640ff42db6b # timeout=10 New run name is '#14' Path To MSBuild.exe: C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe Executing the command cmd.exe /C " chcp 1252 & "C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe" /p:Configuration=Debug; %workspace%/FormatToFormat/FormatToFormat.sln " && exit %%ERRORLEVEL%% from C:\Program Files (x86)\Jenkins\workspace\First Windows Project [First Windows Project] $ cmd.exe /C " chcp 1252 & "C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe" /p:Configuration=Debug; %workspace%/FormatToFormat/FormatToFormat.sln " && exit %%ERRORLEVEL%% Active code page: 1252 Microsoft (R) Build Engine version 14.0.25420.1 Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1005: Specify a property and its value. Switch: /p:Configuration=Debug;

For switch syntax, type "MSBuild /help" Build step 'Build a Visual Studio project or solution using MSBuild' marked build as failure New run name is '#14' Finished: FAILURE config