Open rainersigwald opened 2 years ago
Note that the same is true for MSBuildWarningsAsErrors—that is, using commas as delimiters doesn't work. In testing that, it also seemed that when I promoted the warnings to errors, the build still "succeeded." I think that was a bug you fixed at some point, @BenVillalobos? Do you remember what version that was in? I seem to be using 17.0.0.52104, and I'd thought it was before that.
That was fixed around 16.10. I don't see that behavior in 17.1.0-preview-21572-11+b1e1a581a
Also tested MSBuildWarningsAsErrors with this repro on 17.0.0-preview-21308-06+420c91c69 and the build failed like it should (using semicolons as the delimiter)
Can confirm this is still broken in MSBuild version 17.8.3+195e7f5a3 for .NET
. CSC honors comma separators but MSBuild does not.
Here's a simple repro. project.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<NoWarn>$(NoWarn);MYWARN0001;BOGUS0001,MYWARN0002,CS1030,BOGUS0001</NoWarn>
</PropertyGroup>
<Target Name="WarnTest" AfterTargets="BeforeBuild">
<Warning Code="MYWARN0001" Text="This is a warning." />
<Warning Code="MYWARN0002" Text="This is another warning." />
</Target>
</Project>
class.cs
#warning Warning from C#
The CS1030
is suppressed since CSC handles the comma separated values. MYWARN0001
is suppressed since it's surrounded by semi-colons. MYWARN0002
is not suppressed.
I just broke our official build because of this: https://github.com/dotnet/machinelearning/pull/6935
We don't:
_Originally posted by @Forgind in https://github.com/dotnet/msbuild/pull/7089#discussion_r758470716_