Tuples not working? (Predefined type System.ValueTuple is declared in multiple references)

I just installed the latest Visual Studio 2017 and LINQPad v5.31 on a new computer, but my existing LINQPad queries and any new queries I create that make use of the new C# tuple syntax do not work.

CS8137 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?

CS8356 Predefined type 'System.ValueTuple`2' is declared in multiple referenced assemblies: 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'

I find this odd because I get the same message regardless of whether or not I add the ValueTuple package to my query. This used to "just work" so I'm a little stumped. Works fine in Visual Studio. I don't recall ever having to try to manually add the assembly with System.Runtime.CompilerServices.TupleElementNamesAttribute.

Comments

  • Do you have any references to System.ValueTuple in My Extensions, or in the plugins folder (Edit | Preferences | Folders). And when you press F4, does anything show in references?
  • How embarrassing... I forgot... it would turn out that we recently took on a dependency on System.ValueTuple (v 4.5.0) in our software, and I have our DLLs in my extensions folder. If I delete System.ValueTuple from my extensions folder, that resolves the problem.

    I generally like having the extensions folder pointed at our application's output directory so I don't have to deal with adding assemblies to my queries on a regular basis, especially as I hop between branches. What's the best way to make this work? Can I get away with a binding redirect in LINQPad or something?
  • You could create symlinks to any assemblies you might need references to and have them point to your output files. That way you don't have to create tasks to copy them over or otherwise, reference them directly.
  • I did make a symlink for the output directory. Output directories are buried somewhere in my filesystem, but I have symlinks at C:\bin_[branchname] to those output directories. LINQPad points to the symlink folder.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!