How can I enable all features of C# 7 in Visual Studio 2017 project?

For arbitrary task-like types you linked to in the 2nd part of your question you need to include the System.Threading.Tasks.Extensions package.

The reason you need these NuGet packages is because the new language features rely on new types added to the .NET framework. The new types that the C# language features depend on will not be “built in to the framework” until the next minor version released after 4.6.2 to not break SemVer1. So unless you are building a project using that next version of the framework you will need to use the NuGet packages to get the features to work.

This is no different than getting extension methods to work in a .NET 2.0 project. You can use extension methods but you need to use a NuGet package (or add the code yourself) to get the types it relies on to be added to your project.


1: So 4.7 or 5.0, whatever they decide to call it, if there is a 4.6.3 it will not be in that version because that is not a minor release version bump, that is a patch version bump and you can’t make API changes in a patch version bump without violating Semantic Versioning.

Leave a Comment