Do you know that, Visual Studio allows you to select the default language version of your project? The project settings helps you to control the targeted C# language by changing the compiler version.
-
Published by Kunal Chowdhury
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.

Follow the below mentioned steps in Visual Studio to target a desired C# language version for a specific project:
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.
Solution Architect & Former Microsoft MVP
Kunal Chowdhury is an enterprise solution architect and former multi-year Microsoft MVP. He is the author of three technical books: Windows Presentation Foundation Development Cookbook, Mastering Visual Studio 2017, and the Mastering Visual Studio 2019.
He publishes technical articles on Kunal-Chowdhury.com.