How to change the default language version in Visual Studio?
Do you know that, Microsoft Visual Studio allows you to select the default language version of your project? The advanced project settings helps you to control the targeted C# language by changing the compiler version.
By default, the compiler accepts all valid language syntax that it can support. But if you want to change it to point to a specific version, let's learn how to do that.
How to change the default language version?
Follow the below mentioned steps in Visual Studio to target a desired C# language version for a specific project:
- From the
Solution Explorer , right-click on the project node. - Click on
Properties from the context menu. - From the project properties screen, navigate to the
Build tab. - Scroll down the screen and click
Advanced... button, which you can find under theOutput section. This will launch theAdvanced Build Settings dialog window on the screen. - If you are using
Visual Studio 2015 , theLanguage Version list under theGeneral section of theAdvanced Build Settings dialog will look as below: - If you are using
Visual Studio 2017 , theLanguage Version list under theGeneral section of theAdvanced Build Settings dialog will look as below: - Select the C# language version that you want your project to target.
- Click
OK to save the changes.



Do you know?
My book
How it works...
When you select default
(Visual Studio 2015) or C# latest major version (default)
(Visual Studio 2017), the compiler accepts all valid language syntax that it can support.
When you select C# latest minor version (latest)
(Visual Studio 2017), the compiler accepts all valid language syntax that it can support in latest minor version of the compiler.
When you select ISO-1
, the compiler accepts only syntax that is included in ISO/IEC 23270:2003 C# (1.0/1.1). In case of ISO-2
, it accepts only syntax that is included in ISO/IEC 23270:2006 C# (2.0).
If you like to restrict it to a specific version, select the one that best suits your requirement. For example, selecting C# 3.0
will ask the compiler to accept only those syntax that is included in C# 3.0 and lower. Similarly, selecting C# 4.0
will restrict it to C# 4.0 and lower. You can chose other values like C# 5.0
, C# 6.0
, C# 7.0
, C# 7.1
, C# 7.2
from the list.

Why not reach little more and connect with me directly on Twitter, Facebook and LinkedIn. I would love to hear your thoughts and opinions.