Labat
Labat

Reputation: 1

Visual Studio 2022 - Compiler Error CS1900 : Warning level must be in the range 0-4

project.csproj file

<PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <DebugType>full</DebugType>
    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
    <NoWarn>;NU1701</NoWarn>
    <WarningLevel>5</WarningLevel>
    <Optimize>True</Optimize>
    <WarningsAsErrors>;NU1605</WarningsAsErrors>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <DebugType>full</DebugType>
    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
    <NoWarn>;NU1701</NoWarn>
    <WarningLevel>5</WarningLevel>
    <WarningsAsErrors>;NU1605</WarningsAsErrors>
  </PropertyGroup>

I did set WarningLevel to 5 - Warning from C#9 and according to https://learn.microsoft.com/en-us/dotnet/csharp/misc/cs1900?f1url=%3FappId%3Droslyn%26k%3Dk(CS1900) was not expecting any compiler error

Upvotes: 0

Views: 1149

Answers (0)

Related Questions