Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to downgrade C# version in VS 2015?

I have solution which was refactored from C# 6.0 to C# 5.0. What settings should I change in VS 2015 for check that uses of C# 6.0 syntax features are missing in my solution? Can I do this by other way?

like image 962
Valentine Zakharenko Avatar asked Sep 26 '16 14:09

Valentine Zakharenko


2 Answers

Project->Properties->Build->Advanced->Language Version

like image 111
Stefano Balzarotti Avatar answered Oct 13 '22 01:10

Stefano Balzarotti


You can enable this per-project.

In your project's properties, go to "Build", then "Advanced", then select your C# language version.

This settings is not perfect. That is, it can stop you from using some C# features, but it won't disable some changes in the compiler.

For example, C# 6 introduced improved overload resolution. This remains enabled regardless of what language version is selected in the project. This means that it is possible to write code in VS 2015 that does not compile in VS 2013, even if the language version is forced to C# 5.

If your intention is to use this so that you can guarantee your code will continue to compile with the true C# 5 compiler, then there isn't much you can do about it, however the overload resolution remains small corner-case.

like image 42
vcsjones Avatar answered Oct 13 '22 02:10

vcsjones