February 27th, 2019
0 reactions

An update to C# versions and C# tooling

Program Manager

Starting with Visual Studio 2019 Preview 4 and RC, we’ll be adjusting how C# versions are treated in .NET tooling. The version of C# used by your project will now be determined by target framework.

Summary of changes

The most important change is that the version of C# used by tooling by default will be determined by the target framework of your project.

Additionally, we are adding two new Language Version (LangVer) values: LatestMajor and Preview. Here’s how they stack up compared with the currently supported list of values:

LangVersion Meaning
ISO-1 C# 1.0/1.2
ISO-2 C# 2.0
3 C# 3.0
4 C# 4.0
5 C# 5.0
6 C# 6.0
7 C# 7.0
7.1 C# 7.1
7.2 C# 7.2
7.3 C# 7.3
8.0 C# 8.0
LatestMajor Latest supported major C# language version
Preview Latest available preview C# language version
Latest Latest supported C# language version (including minor version)

 

The meaning of “supported C# language version” differs based on target, and the default used is also determined by the target of your project.

How this works for .NET Core 3.0 and .NET Standard 2.1

C# 8.0 has been built with .NET Core 3.0 and .NET Standard 2.1 in mind. Many of its features only work on .NET Core 3.0. This means .NET Core 3.0 and .NET Standard 2.1 are the only .NET Core and .NET Standard versions where C# 8.0 is supported.

How this works for all other target frameworks

Because C# 8.0 has been built for .NET Core 3.0 and .NET Standard 2.1, it will not be supported outside of .NET Core 3.0 and any platform implementing .NET Standard 2.1.

Support and compatibility for preview features

This change means that C# 8.0 preview will be the default for .NET Core 3.0 preview in all .NET tools, including Visual Studio. The way to think about support in this world is slightly different than before. We distinguish support today along the following lines:

  • Any C# 7.3 and lower feature or behavior is fully supported and fully compatible in any context (.NET Core 3.0, .NET Core 2.x, .NET Framework, etc.). No change from what exists today.
  • Any C# preview feature is unsupported.
  • There is no compatibility guarantee from one C# preview to another.

In short, if you use C# 8.0 preview with Visual Studio 2019, some features and behaviors may change between now and when C# 8.0 fully releases.

Happy hacking!

Author

Phillip Carter
Program Manager

Phillip is a PM on the .NET team, focusing on the F# language, F# documentation, F# tooling, and project system tooling. He wishes he had more time to code, but that doesn't stop him from having fun with people on GitHub. He loves functional programming and language-related tooling, and is always available to chat about wild and wacky ways to make programming more enjoyable.

14 comments

Discussion is closed. Login to edit/delete existing comments.

Sort by :
  • Koen Janssens

    Will this also apply fot VB.net?

  • Max Mustermann

    Where do I get netstandard2.1 preview? Using VS2019 Preview4/RC with latest netcore3.0 preview just gives me: error NETSDK1045: The current .NET SDK does not support targeting .NET Standard 2.1

    • Akash Bagh

      This comment has been deleted.

  • SuperCocoLoco .

    I want to see the same evolution to Visual Basic.NET.

  • Stuart Lang

    I had to double take when I saw a C# post from you Phillip 😆 Have you got a promotion?

    • Phillip CarterMicrosoft employee Author

      I’m still doing loads of F# stuff, just helping out with some C# things too 🙂