C# compiler throws Language Version (LangVersion) reference error "Invalid 'nullable' value: 'Enable' for C# 7.3"

Viewed 21177

I have solution with couple .NET Standard projects in all I wanted to enable c# 8 and nullable like below:

<PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
    <LangVersion>8.0</LangVersion>
    <Nullable>enable</Nullable>
  </PropertyGroup>

Note: These settings are found in your .csproj file.

The problem is that some projects are compiling fine and some have error:

Invalid 'nullable' value: 'Enable' for C# 7.3. Please use language version 'preview' or greater

I have Visual Studio 16.2 Preview 2 and .NET Core 3 Preview 6. Is this a bug in preview or I'm doing something wrong?

1 Answers

You should try <LangVersion>preview</LangVersion> as the error message suggests.

Related