Predefined type #39;System.ValueTuple#180;2#180; is not defined or imported(未定义或导入预定义类型“System.ValueTuple2)
问题描述
我已经安装了 Visual Studio 15 Preview 3 并尝试使用新的元组功能
I've installed Visual Studio 15 Preview 3 and tried to use the new tuple feature
static void Main(string[] args)
{
var x = DoSomething();
Console.WriteLine(x.x);
}
static (int x, int y) DoSomething()
{
return (1, 2);
}
编译时出现错误:
未定义或导入预定义类型System.ValueTuple´2"
Predefined type 'System.ValueTuple´2´ is not defined or imported
根据 博文,这个功能默认应该是开启"的.
According to the blog post, this features should be "on" by default.
我做错了什么?
推荐答案
对于 .NET 4.6.2 或更低版本、.NET Core 1.x 和 .NET Standard 1.x 需要安装 NuGet 包 System.ValueTuple
:
For .NET 4.6.2 or lower, .NET Core 1.x, and .NET Standard 1.x you need to install the NuGet package System.ValueTuple
:
Install-Package "System.ValueTuple"
或者在 VS 2017 中使用包引用:
Or using a package reference in VS 2017:
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
.NET Framework 4.7、.NET Core 2.0 和 .NET Standard 2.0 包括这些类型.
.NET Framework 4.7, .NET Core 2.0, and .NET Standard 2.0 include these types.
这篇关于未定义或导入预定义类型“System.ValueTuple´2"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:未定义或导入预定义类型“System.ValueTuple´2"


基础教程推荐
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01