Migrating project to .NET 4.6 and C# 6

Migration process of the project to .NET 4.6 and C# 6 is quite simple, but still requires some steps to do.

.NET 4.6

First check if your Continuous Integration server supports project build for .NET 4.6. For example, Team City starting version 9 supports it.

Next check if your target servers have .NET 4.6 installed.

Now change project's target framework to .NET 4.6, rebuild, commit, push.

C# 6

If you are using VS 2015, then C# 6 should be working out of the box, but it will not work in VS 2013. To be able to compile project in VS 2013 with C# 6 features, install Microsoft.Net.Compilers NuGet package to your project:

Install-Package Microsoft.Net.Compilers

Also, if you are using ReSharper (version 9 and up), you have to configure it to use C# 6 syntax. Select project in Solution Explorer and open Properties pane. Under ReSharper section change C# Language Level to C# 6.0.

ReSharper C# 6.0 settings

Now C# 6 features should be available and the project should compile.

There was one issue after the first build - Visual Studio displayed me C# 6 features as errors. Deletion of .suo file and restarting Visual Studio helped to solve it.