Which version of C# am I using in Visual Studio 2019 (2024)

If you’re using the latest version of Visual Studio 2019, C#, you may not see the option to change the C# language version of your project. This is a new change in Visual Studio 2019/.NET Core 3.0. The new C# compiler chooses the default version based on your .NET target framework selected for your project in Visual Studio.


The compiler determines a default language based on the following rules:

Target framework version C# language version default

.NET Core3.xC# 8.0
.NET Core2.xC# 7.3
.NET FrameworkallC# 7.3

Note: If you’re using a previous version of Visual Studio, you’ve an option to select a language version up to C# 7.3.

C# 8.0 is the latest version of C# language. C# 8.0 introduces several new features. To learn more about these features, visit https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-8

Can I change the default C# version?

Yes, you may.

If you open your .csproj project file in Notepad or any text editor, you can add a new property group and set the LangVersion value to specify the language version your project will use. The default proj file looks like the following in XML.

<ProjectSdk="Microsoft.NET.Sdk"><PropertyGroup><OutputType>Exe</OutputType><TargetFramework>netcoreapp3.0</TargetFramework></PropertyGroup></Project>The<ProjectSdk="Microsoft.NET.Sdk"><PropertyGroup><OutputType>Exe</OutputType><TargetFramework>netcoreapp3.0</TargetFramework></PropertyGroup><PropertyGroup><LangVersion>8.0</LangVersion></PropertyGroup></Project>

The LangVersion value can be one of the following:

preview
latest
latestMajor
8.0
7.3
7.2
7.1
7, 6, 5, 4, and 3

    Which version of C# am I using in Visual Studio 2019 (2024)
    Top Articles
    Latest Posts
    Article information

    Author: Van Hayes

    Last Updated:

    Views: 6280

    Rating: 4.6 / 5 (66 voted)

    Reviews: 89% of readers found this page helpful

    Author information

    Name: Van Hayes

    Birthday: 1994-06-07

    Address: 2004 Kling Rapid, New Destiny, MT 64658-2367

    Phone: +512425013758

    Job: National Farming Director

    Hobby: Reading, Polo, Genealogy, amateur radio, Scouting, Stand-up comedy, Cryptography

    Introduction: My name is Van Hayes, I am a thankful, friendly, smiling, calm, powerful, fine, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.