user3126358
user3126358

Reputation: 511

Tuple syntax in VS 2017

In VS2017 RC, when you tried to use new tuple syntax, you received the following error:

CS8179 Predefined type 'System.ValueTuple`X' is not defined or imported

In order to use tuple syntax, you had to manually import ValueTuple nuget package into the project. Not a big deal, as it was pre-release version and I thought it will be changed in RTM so it will be enabled by default. Unfortunately in the final release version it is still the case and you have to download nuget package for every single project to use tuple syntax.

Is there a way to have tuple syntax enabled for every project by default?

Upvotes: 25

Views: 3365

Answers (1)

Daniel A. White
Daniel A. White

Reputation: 190945

According to https://github.com/dotnet/roslyn/issues/13177, the ITuple and ValueTuple types will be added to mscorlib in "the first version after" .NET Framework 4.7. According to the .NET Framework 4.7 release notes, it has been added. Adding it to 4.6.x would break semver. Hence they provided the types as a Nuget package so that projects based on older framework versions can use it.

This is akin to a .NET 2.0 project wanting to use LINQ which the extension methods lived in System.Core, not mscorlib.

One option you could do is create your own project templates in the interim that reference the NuGet package.

Upvotes: 25

Related Questions