dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.24k stars 5.89k forks source link

WarningLevel is not always automatically set by AnalysisLevel #33559

Open cremor opened 1 year ago

cremor commented 1 year ago

The article contains the following information:

Warning waves are enabled using the AnalysisLevel element in your project file.

A similar information is written in the article C# Compiler Options:

However, the .NET SDK sets the WarningLevel to match the AnalysisLevel in your project file.

This is not entirely true. It is true for .NET 7 projects. But it isn't true for old .NET Framework projects, even if they use a SDK style csproj file. For those projects you have to explicitly set <WarningLevel> to get warnings from warning waves.

Note: This might be a change in the .NET 7 SDK. If I remember correctly the .NET 6 SDK worked as documented, even for .NET Framework projects. See dotnet/sdk#24826


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

mavasani commented 1 year ago

@jmarolf

cremor commented 4 months ago

Related: #41295