You are here
Home > Programming > C# 8.0 – What C# version does my App use?

C# 8.0 – What C# version does my App use?

Target C# 8.0 in .NET Applications

So you have created a new application in Visual Studio 2019. You might be surprised to learn that your application isn’t using C# 8.0 by default. Not unless you are targeting .NET Core 3.x or .NET Standard 2.x.

Looking for Something Else? Try These Links Instead:

Get up to speed quickly by watching the video instead.

This behaviour is by design. To check which version of C# you are using, you will need to delve into your project’s properties.

Am I using C# 8.0 or not?

To figure out which version of C# you are using, you need to right-click on your project in the Solution Explorer and click on Properties from the context menu.

View the project properties

Your project properties will be displayed. Take note of the Target framework selection here. In my screenshot below, it is .NET Core 3.1. Remember this, as it is important. I’ll be coming back to this in a minute.

View the target framework for Visual Studio 2019 project

On the Build tab, towards the bottom, you will see that there is a button called Advanced. Click on that button to open the Advanced Build Settings screen.

Build settings for visual studio 2019 project

When this screen is displayed, you will not see the version of C# your application is using under the Language version section. Instead, you will see text that states that the version of C# is automatically selected based on the version of the .NET Framework you are using.

Advanced build settings does not target C# 8.0

This is where the Target framework setting we saw earlier comes into play. If you can recall, you will remember that we had selected .NET Core 3.1. This means that our project automatically uses C# 8.0.

What C# version is used when?

As mentioned earlier, the project’s target framework determines the default C# language version. It is well defined in this document on Microsoft’s docs website.

Target frameworkVersionC# language version default
.NET Core3.xC# 8.0
.NET Core2.xC# 7.3
.NET Standard2.1C# 8.0
.NET Standard2.0C# 7.3
.NET Standard1.xC# 7.3
.NET FrameworkallC# 7.3

Use C# 8.0 in any .NET Project?

It is possible to use C# 8.0 in any .NET project using Visual Studio 2019. There are, however, a few limitations when doing this. To read more about this and the limitations, see Enabling C# 8 in Visual Studio 2019.

Dirk Strauss
Dirk is a Software Developer from South Africa. He loves all things Technology and is slightly addicted to Jimi Hendrix. Apart from writing code, he also enjoys authoring books and articles. "I love sharing knowledge and connecting with people from around the world. It's the diversity that makes life so beautiful." Dirk feels very strongly that pizza is simply not complete without Tabasco, that you can never have too much garlic, and that cooking the perfect steak is an art he has almost mastered.
https://dirkstrauss.com

Similar Articles

Top