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

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.

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.

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.

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.

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.

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 framework

Version

C# language version default

.NET Core

3.x

C# 8.0

.NET Core

2.x

C# 7.3

.NET Standard

2.1

C# 8.0

.NET Standard

2.0

C# 7.3

.NET Standard

1.x

C# 7.3

.NET Framework

all

C# 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.

Related

Dirk is a Software Developer and Microsoft MVP from South Africa. He loves all things Technology and is slightly addicted to Twitter and Jimi Hendrix. Apart from writing code, he also enjoys writing human readable 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 yet to master.