Skip to content

[build] Passing a property (/property) with multiple values to msbuild isn't working #8792

@evil-shrike

Description

@evil-shrike

I need to pass values for NoWarn option to C# compiler. Previously with msbuild it was being passed as property:

msbuild /p:NoWarn:"1591;1573;3001;3002"

But with dotnet cli it doesn't work anymore.
I tried both build and msbuild commands.

Steps to reproduce

dotnet.exe msbuild /property:NoWarn=1591;1573;3001;3002 mysolution.sln

or

dotnet.exe msbuild /property:NoWarn="1591;1573;3001;3002" mysolution.sln

or

dotnet.exe msbuild "/property:NoWarn=1591;1573;3001;3002" mysolution.sln

all result in

MSBUILD : error MSB1006: Property is not valid.
Switch: 1573

With dotnet.exe build` there's the same error.

While if I set these values in csproj:

<NoWarn>1591;1573;3001;3002</NoWarn>

it works as expected (warning are being ignored)

Expected behavior

Pass all warning code to the compiler.

Actual behavior

Faulting with an error

Environment data

dotnet --info output:

D:\>dotnet --info
.NET Command Line Tools (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.15063
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.0\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions