C# Interactive not recognizing ValueTuple reference

最后都变了- 提交于 2019-12-11 07:58:38

问题


I cannot use tuples in the C# Interactive window; I get the following error:

(1,15): error 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?
(1,15): error CS8179: Predefined type 'System.ValueTuple`2' is not defined or imported
(2,9): error CS0103: The name 'IsLiteralTypeName' does not exist in the current context
(2,47): error CS8179: Predefined type 'System.ValueTuple`2' is not defined or imported
(5,12): error CS8179: Predefined type 'System.ValueTuple`2' is not defined or imported

This even after I've added a reference to the ValueType assembly:

#r "D:\MyProject\packages\System.ValueTuple.4.3.1\lib\netstandard1.0\System.ValueTuple.dll"

How can I make use of value tuples from the C# Interactive window?


回答1:


Remove /r:System.ValueTuple.dll from

C:\Program Files (x86)\Microsoft Visual Studio\2017\<edition>\Common7\IDE\CommonExtensions\Microsoft\ManagedLanguages\VBCSharp\InteractiveComponents\CSharpInteractive.rsp

for Visual Studio 2017 and

C:\Program Files (x86)\Microsoft Visual Studio\2017\<edition>\MSBuild\15.0\Bin\Roslyn\csi.rsp

for the command line tool (csi.exe)



来源:https://stackoverflow.com/questions/45306204/c-sharp-interactive-not-recognizing-valuetuple-reference

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!