aspnetcore: Predefined type 'System.ValueTuple is not defined or imported

ASP.NET Core Web Application targeting .net 4.7.1 cannot use System.ValueTuple.

Repro:

  1. Create a new ASP.NET Core Web Application that targets .net 4.7.1
  2. Add a class that has a tuple
  3. Observe errors. -Cannot define a class or member that utilizes tuples because the compiler required type ‘System.Runtime.CompilerServices.TupleElementNamesAttribute’ cannot be found. Are you missing a reference? -Predefined type ‘System.ValueTuple`2’ is not defined or imported

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 25 (23 by maintainers)

Most upvoted comments

I’m strongly against cross-compiling extensions to .NET Framework. I think we need to lean harder on the .NET Standard team to resolve this issue. If making the type issues with System.ValueTuple and net471 are truly impossible, I think .NET Standard team should update docs and tools to encourage users to target .NET 4.7.2 because anything less is not actually compatible with netstandard2.0.

I know there are important tradeoffs to weigh, but if we, as a part of the .NET team, have to cross-compile to .NET Framework to workaround this, then I think netstandard2.0 has failed deliver on one if its major promises.