“Predefined type System.ValueTuple is not defined or imported” after upgrading to .NET 4.7

后端 未结 2 541
抹茶落季
抹茶落季 2021-01-01 12:56

I\'m upgrading an existing solution from .NET 4.6.2 to .NET 4.7. This solution depends on several nuget packages that target .NET 4.6.2 and hence depend on the nuget System.

相关标签:
2条回答
  • 2021-01-01 13:32

    Yes, upgrade to System.ValueTuple 4.4.0.

    Here is why:

    The NuGet package System.ValueTuple provides the ValueTuple types which are required for the C# tuple syntax. In .NET Framework 4.7 we've added the types directly to mscorlib. If you use both, the NuGet package, as well as .NET Framework 4.7 you'll end up seeing the same types multiple times. This results in issues like this one reported on Stack Overflow.

    We've updated the NuGet package to type forward the tuple types on .NET Framework 4.7 to mscorlib. This unifies the types and thus allows you to consume other libraries and NuGet packages that depend on System.ValueTuple while still targeting .NET Framework 4.7.

    See release notes.

    0 讨论(0)
  • 2021-01-01 13:33

    In Visual Studion ,NuGet package System.ValueTuple provides the ValueTuple types. So Update System.ValueTuple to latest version v4.4.0. Means Upgrade the System.ValueTuple to higher version then the current or previous one.

    0 讨论(0)
提交回复
热议问题