Due to a regression (which I believe originated from #24826), the WarningLevel property is no longer set to match the AnalysisLevel property, it is only set to match the TFM. (Except for AnalysisLevel=preview, which still results in /warn:9999)
For example, running dotnet build /p:AnalysisLevel=4 should result in /warn:4 option being passed to the C# compiler, but this stopped working, I believe in .NET 7.
Describe the bug
Due to a regression (which I believe originated from #24826), the
WarningLevel
property is no longer set to match theAnalysisLevel
property, it is only set to match the TFM. (Except forAnalysisLevel=preview
, which still results in/warn:9999
)For example, running
dotnet build /p:AnalysisLevel=4
should result in/warn:4
option being passed to the C# compiler, but this stopped working, I believe in .NET 7.To Reproduce
Example project file:
Example Program.cs:
(Note that class
program
is lower case, which is warningCS8981
in warning wave 7)Output of
dotnet build --verbosity normal
using .NET 8 SDK:(Note that
CoreCompile
passes/warn:8
instead of the expected/warn:4
)Exceptions (if any)
Further technical details