CS8179 Predefined type 'System.ValueTuple`2' is not defined or imported
I have a .NET 4.5.2 library that ships in a NuGet package (with LINQPad samples). It uses C#7 tuples, so my NuGet package declares a dependency on the System.ValueTuple package. When attempting to run code (i.e., a Query) that depends on my NuGet package, it fails to run/compile with the following error: CS8179 Predefined type 'System.ValueTuple`2' is not defined or imported
If I create a new Query window and use tuples (without my NuGet package), it works fine. It's not clear whether there's an issue with LINQPad v5.22.02 and ValueTuples when pulled-in via a NuGet package or whether there's an issue with my NuGet package (it's a pretty simple package, so I'm not sure what could be wrong).
I've uploaded the script that reproduces the CS8179 issue with "instant share"...
http://share.linqpad.net/kx9ugx.linq
Any suggestions on how to fix this issue? Is anyone else able to reproduce the issue?
Thanks.
If I create a new Query window and use tuples (without my NuGet package), it works fine. It's not clear whether there's an issue with LINQPad v5.22.02 and ValueTuples when pulled-in via a NuGet package or whether there's an issue with my NuGet package (it's a pretty simple package, so I'm not sure what could be wrong).
I've uploaded the script that reproduces the CS8179 issue with "instant share"...
http://share.linqpad.net/kx9ugx.linq
Any suggestions on how to fix this issue? Is anyone else able to reproduce the issue?
Thanks.
Comments
Given that your NuGet package references System.ValueTuple.dll, this would appear to make it incompatible with Framework 4.7: it wants to use the ValueTuple type in System.ValueTuple.dll, whereas anything you compile under Framework 4.7 will want to use the ValueTuple type in mscorlib.dll.
Do you get the same problem in Visual Studio?
Do you recommend I modify my NuGet package to explicitly declare the System.ValueTuple package dependency for net45, yet explicitly exclude it from net47 and any other version that has those types built-in? I thought the System.ValueTuple package should do that, not mine. Is that correct?