Visual Studio 2015 is out and brings us the new C# 6 language features. We also have the new .Net 4.6 Runtime. But what does that mean?

Well, the framework version and language version are two separate concerns. You can practically pick any framework, with any language, and it will work. This means that If you want to use C# 6 features on your .Net 4.0 application, you can. Ok, so some language features require specific framework libraries, like generics, and async, but most features tend to be syntactic sugar. You have to use VS 2015 to have a compiler with the C# 6 features, but you can also use .Net 4.6 in Visual Studio 2013 with C# 5 and older language versions.

There is no reason I can think of to not upgrade to Visual Studio 2015 for your application development. But maybe there is some obscure edge case or policy that stops you, or some of your team, from upgrading. By default, projects will use the latest language version when built in Visual Studio, and so early adopters will start seeing hints and suggestions to use these new features. How can we stop ourselves and our team from breaking compilation in VS 2013?

Like I said, by default a project will use the latest version that Visual Studio supports. If you want to lock in down to a specific version, 5 in this case, you can add the following to your *.csproj file:

<PropertyGroup ...>

But really, who would do this by hand? From Visual Studio, you right-click on your project in Solution Explorer, and select Properties from the context menu. From the project settings window, select the Build tab from the left, and click the Advanced... button in the bottom right of the settings window.

In the dialog that opens, you will see the Language Version setting at the top. Change this from default to the version you want to use (in this case C# 5.0). Repeat with each configuration you want this to apply to (Release, Debug, any custom configuration you might have) and then with each project you want to apply it to. This is what adds the LangVersion XML I showed you before.

One more thing, If you use ReSharper. With your project selected in Solution Explorer, view the Properties window. You will see ReSharper's C# Language Level. This is what drives ReSharper hints. This also has a default which matches the version selected in the project, and a way to force a specific language version. Select C# 5.0 here and ReSharper will stop suggesting the new features to you, even if you have the project set to default on VS 2015, or set to C# 6.0 specifically. You may want to use this setting locally just to turn of the new features without changing the *.csproj, since this setting is part of ReSharper's *.dotsettings file (and usually not checked into Source Control).

Set this up if you need it, and your team won't complain at you for using new features that break their flow while they are stuck in VS 2012 or 2013, while you race ahead with the productivity features build into the new VS 2015 IDE.

Your mileage may vary, and the ReSharper settings may be enough for you. But if you have a wider team and only a minority using older versions, or if you are the only guy stuck on the old IDE, then forcing compile time errors on the rest of the team when they try and use the new feature will save time for everyone in the long run.