我在将 Web 项目从 RC1 迁移到 RC2 时遇到了一些问题。当我切换时,我在整个项目中遇到了一堆这样的错误。
The type 'Func<,>' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
看起来所有的 linq 函数和 lambda 表达式都不起作用。
这是我的 project.json
文件的样子:
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"System.Linq": "4.1.0-rc2-24027"
},
"imports": [ "net451", "portable-net45+win8" ]
}
},
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027",
"Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",
"System.ComponentModel.Annotations": "4.1.0-*"
}
知道这是什么意思吗?我试过运行 dotnet restore
,但没有帮助。
最佳答案
我遇到了同样的问题,将以下包添加到我的 project.json
依赖项中为我修复了它:
"Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc2-24027",
此包支持与基于 mscorlib 的 PCL 的兼容性。
关于c# - 您必须添加对程序集 mscorlib 的引用,version=4.0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37468552/