Change C# 6 Language Version To C# 5 In Visual Studio 2015

Sometimes we need to change the C# language version. It is required in many cases suppose you have done some code in C# 6 but client is asking to provide the code in C# 5 or C# 4. But you do not exactly remember how many features you have used which is only available in C# 6 but not in any other lower version.

I have written some articles on C# 6 features and in that case I need to know that what was actual status for this feature in lower version. For that I need to change the language version many times from C# 6 to C# 5 or C# 4. This is a very common practice, many of us may know it, but it will be helpful for those people who are not aware about it. Let’s have a look on how to change the language version.

To change the language do the following things:

Step 1: Select the project from the solution explorer window for which you want to change the language version and right click on it.

Step 2: Click on properties or Press “Alt + Enter”. It will open a new window.

properties

Step 3: Click on Build tab as in the following image.

Step 4: Click on Advanced Button.

advanced

Step 5: Go to Language Version dropdown list and select the language version whatever you want.

build

advanced build

Let’s say change it to C# 5.

Step 6: Click on OK button after changing the language in dropdown.

general

Now click on save button to save it.

save

That’s it. Now the language has been changed and if there is any written code which is not supported in C# 5. It will give error during project build.


Similar Articles