kunal-chowdhury.com

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 in Visual Studio?

 

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:

  1. From the Solution Explorer, right-click on the project node.
  2. Click on Properties from the context menu.
  3. From the project properties screen, navigate to the Build tab.
  4. Scroll down the screen and click Advanced... button, which you can find under the Output section. This will launch the Advanced Build Settings dialog window on the screen.
  5.  

    Visual Studio project build properties

     

  6. If you are using Visual Studio 2015, the Language Version list under the General section of the Advanced Build Settings dialog will look as below:
  7.  

    Visual Studio 2015 advanced build settings

     

  8. If you are using Visual Studio 2017, the Language Version list under the General section of the Advanced Build Settings dialog will look as below:
  9.  

    Visual Studio 2017 advanced build settings

     

  10. Select the C# language version that you want your project to target.
  11. Click OK to save the changes.

 

Do you know?

My book Mastering Visual Studio 2017 is now available on Amazon and Flipkart at a discounted price. Click here to buy it.

 

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.

 

 



If you have come this far, it means that you liked what you are reading. Why not reach little more and connect with me directly on Twitter, Facebook, Google+ and LinkedIn. I would love to hear your thoughts and opinions on my articles directly.

Also, don't forget to share your views and/or feedback in the comment section below.

0comments


© 2008-2018 Kunal-Chowdhury.com | Designed by Kunal Chowdhury
Back to top