An update to C# versions and C# tooling

Phillip Carter

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!

14 comments

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

  • Ilya Veselov 0

    What about the current LatestMinor value used in projects targeting the latest C# version, and how it will be migrated?

    • Phillip CarterMicrosoft employee 0

      LatestMinor is not a supported LangVersion value today, but what you are referring to is Latest. The meaning of this value is unchanged, and if you have set it explicitly, that value will still be respected. So any projects that are using C# 7.3 features (which Latest currently gives you) will behave exactly the same as they do today.

  • MgSam 0

    So you’re saying that C# 8.0 is not shipping with VS 2019? That is disappointing (but not entirely surprising given how many features are still in it).
    So will it be an out-of-band release or is it getting pushed back to VS 2020 or whatever the next VS version is?

    • Zoey M 0

      I think it is going to ship. The features so far are in the RC that came out today. 

    • Phillip CarterMicrosoft employee 0

      C# 8.0 will be in Preview when VS 2019 GA is released. C# 8.0 is going to release alongside .NET Core 3.0, which will be later this year. Until that time, you can use C# 8.0 as a preview with VS 2019; however, those features will be considered in preview and are subject to changes until C# 8.0 is fully released.

  • Tony Henrique 0

    This is the right move. New C# 8 features still need improvements and changes.

  • Heinrich Moser 0

    Just out of curiosity: What was the rationale behind the previous “LatestMajor” default value? That option always struck me as odd: I don’t want small (= low-risk) updates, but I do want large (= high-risk) updates? How does that make sense? (This is an honest question, not a rant!)

    • Phillip CarterMicrosoft employee 0

      I don’t have the full history, but I believe the reasoning for the previous behavior was twofold: Firstly, we only ever shipped a new C# version with Visual Studio, and we never did minor versions prior to VS 2017. So it wasn’t really an issue until VS 2017.In VS 2017, although we had planned on minor release updates throughout the VS 2017 lifecycle, it happened that C# 7.0 was the one that shipped with VS 2017 GA, so the LatestMajor and Latest values were equivalent.
      Changing the default in a VS 2017 update was deemed risky from the perspective of moving someone’s cheese. However, as you point out, many people much preferred using the latest C# version and were annoyed with having to always specify this explicitly, so we ultimately decided that this is preferable. Nobody’s complained so far 🙂

  • Stuart Lang 0

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

    • Phillip CarterMicrosoft employee 0

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

  • SuperCocoLoco . 0

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

  • Max Mustermann 0

    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

    • Wil Wilder Apaza Bustamante 0

      This comment has been deleted.

  • Koen Janssens 0

    Will this also apply fot VB.net?

Feedback usabilla icon