我刚刚将一个.Net标准1.4PCLDLL升级到了.Net标准2.0。我正在尝试编写一个返回ValueTuple的方法,但得到了错误:
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?但它is...kind of.下面是我的project.json所说的:
{
"supports": {},
"dependencies": {
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
"NETStandard.Library": "2.0.0",
"Newtonsoft.Json": "10.0.3",
"System.Collections.Specialized": "4.3.0",
"System.ComponentModel.Annotations": "4.4.0",
"System.Net.Http": "4.3.2",
"System.Reflection": "4.3.0",
"System.Runtime.Serialization.Primitives": "4.3.0",
"System.ServiceModel.Primitives": "4.4.0",
"System.ValueTuple": "4.4.0"
},
"frameworks": {
"netstandard2.0": {}
}
}但当我展开项目的参考资料时,我注意到有几个包没有列出。

我试过这个answer,但没有成功。
编辑:我正在使用VS 2017
发布于 2017-08-22 03:31:29
我无法绕过这个乱局,所以我最终只是创建了一个基于.net标准2.0的全新项目。将我的所有文件复制到新项目中,并将其添加为对所有项目的引用。它弄坏了我的resharper,但其他一切都正常。
发布于 2017-08-21 06:06:12
我也遇到了这个问题。即使引用的版本是.NET Core2.0,我的.csproj文件也包含以下几行代码。我删除了这些行,成功地构建了项目。
<RuntimeFrameworkVersion>1.1.2</RuntimeFrameworkVersion>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback>https://stackoverflow.com/questions/45764742
复制相似问题