New C sharp 7 features in action: Migrate existing .NET 4 or .NET 4.5 Application to VS 2017 to support/enable C sharp 7

Step 1: Open your existing .NET 4 or .NET 4.5 application in VS 2017,  this will work smoothly.

Step 2: Update Nuget package to support/enable C# 7

Existing packages that are required to be updated:

Nuget Packages To Update For CSharp7

Update Microsoft.Net.Compilers & Microsoft.CodeDom.Providers.DotNetCompilerPlatform to latest versions.

Microsoft.Net.Compler Nuget Pakage Update

Microsoft.CodeDom.Providers.DotNetCompilerPlatform Nuget Package Update

Step 3: Support for C# 7 Tuple Types and Tuple Literals

Install System.ValueTuple Nuget package

System.ValueTuple Nuget Package

That’s it,  you should be able to use C# 7 features in your .Net Application.

Step 4: Set Language Version to C# 7 in  of C# project file (not required in most of the cases)

Advanced Build Settings Set Language Version C sharp 7

Happy Coding !!!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *