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.ValueTuple package.
But after upgrading, I'm getting a whole bunch of these build errors:
Error CS8179 Predefined type 'System.ValueTuple`2' is not defined or imported
I can't remove the System.ValueTuple
package, as suggested in the comments here, because other packages depend on it. (And if I force it, they seem to blow up.)
Any suggestions?
Update 8/8/17
I've figured out that I can remove the System.ValueTuple
package, and I can get the solution to compile that way. However, I've got a dozen NuGet packages in the solution which appear to be targeting .NET 4.6.2, and hence require System.ValueTuple
as a dependency. I can install those, and then force remove the System.ValueTuple
package, but if any of those packages have an update, and I install the update - then the System.ValueTuple
package gets installed again, and the system stops building until I remove the package all over again.
In other words, I can make it all work - but it seems awkward and kludgy. Surely there's a better way to approach this?
Yes, upgrade to System.ValueTuple 4.4.0.
Here is why:
The NuGet package
System.ValueTuple
provides theValueTuple
types which are required for the C# tuple syntax. In .NET Framework 4.7 we've added the types directly tomscorlib
. 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 onSystem.ValueTuple
while still targeting .NET Framework 4.7.
See release notes.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With