Coder Perfect

Is the.NET Framework supported by C# 8?


C# 8 does not appear to be available for a.NET Framework project in the Advanced Build options of Visual Studio 2019, only for a.NET Core 3.0 project (as seen below):

Does C# 8 support the .NET Framework?

Asked by James Harcourt

Solution #1

In Visual Studio 2019, C# 8 can be used with the.NET Framework and other targets older than.NET Core 3.0/.NET Standard 2.1. (or older versions of Visual Studio if you install a NuGet package).

The only need is that the language version in the csproj file be set to 8.0. You can also do this in Directory.Build.props and have it apply to all of your solution’s projects. For instructions on how to achieve this in Visual Studio 2019, version 16.3 and newer, see the section below.

The majority – but not all – features are available regardless of whatever framework is used.

The following features are merely syntax modifications; they don’t matter what framework you’re using:

These call for new types that aren’t included in the.NET Framework. They can only be used with NuGet packages or code files that contain “polyfill”:

Default interface members will not compile and will never work under the.NET Framework because they require CLR runtime adjustments. The.NET CLR is now deprecated, as.NET Core is the way to go.

For more information on what does and doesn’t work, and on possible polyfills, see Stuart Lang’s article, C# 8.0 and .NET Standard 2.0 – Doing Unsupported Things.

Visual Studio 16.2.0 compiles the following C# project, which targets.NET Framework 4.8 and uses C# 8 nullable reference types. I made it by starting with the.NET Standard Class Library template and then changing the target to the.NET Framework:


<Project Sdk="Microsoft.NET.Sdk">


namespace ClassLibrary1
    public class Class1
        public string? NullableString { get; set; }

The identical nullable reference type feature was introduced to a.NET Framework 4.5.2 WinForms project using a legacy.csproj format. I saved the project after changing the language type in the Visual Studio Advanced Build settings box (disabled in 16.3) to newest. Of course, it doesn’t build at this point. I opened the project file in a text editor and changed the build configuration PropertyGroup: latest to preview.

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

I then added Nullable>enable/Nullable> to the main PropertyGroup to enable support for nullable reference types:


I rebuilt the project after reloading it.

In the RTM version of Visual Studio 2019, version 16.3, the launch version for C# 8.0, there has been a significant change: The dropdown menu for language selection has been disabled:

The following is Microsoft’s explanation:

C# language versioning is the document that appears when you open it. For.NET Core 3.x ONLY, C# 8.0 is shown as the default language. It also verifies that each framework version will have a single supported and default version moving forward, and that the language’s framework agnosticism is no longer valid.

For.NET Framework projects, the language version can still be set to 8 by modifying the.csproj file.

C# 8 was under preview when this solution was first written, so there was a lot of detective work required. For the sake of posterity, I’m leaving that information here. If you don’t need to know all the gruesome details, feel free to skip it.

Although some features have required new types or CLR support, the C# language has generally been mostly framework neutral – that is, it has been able to compile older versions of the Framework.

Most C# fans would have read Mads Torgersen’s blog post Building C# 8.0, which outlines that certain features of C# 8 are platform dependent:

This appears to be similar to Value Tuples, which were first introduced in C# 7. This functionality necessitated the use of new types, the ValueTuple structures, which were not accessible in versions of the NET Framework prior to 4.7 or.NET Standard prior to 2.0. C# 7 could, however, be used with prior versions of.NET, either without or with value tuples, by installing the System. Nuget package ValueTuple Visual Studio recognized this, and everything was good.

However, Mads also wrote:

…which if true would have ruled out using C# 8 with any version of the .NET Framework, and indeed even in .NET Standard 2.0 libraries which only recently we were encouraged to use as a baseline target for library code. You wouldn’t even be able to use it with .NET Core versions older than 3.0 as they too only support .NET Standard 2.0.

– The investigation had begun!

(Jan Kotas)

(Immo Landwerth)

Microsoft does not officially support the C# 8/.NET Framework combo. It’s only for professionals, they claim.

Answered by Stephen Kennedy

Solution #2

The language is actually linked to the framework, according to this blog post:

Answered by user1781290

Solution #3

Answered by Zdravko Zdravkov

Post is based on