我有普通的 c# 控制台应用程序 (.NET 4.6),我想在其中引用 .NET Core 类库:
{
"version": "1.0.0-*",
"dependencies": {
"NETStandard.Library": "1.6.0",
"Newtonsoft.Json": "9.0.1"
},
"frameworks": {
"netstandard1.4": {
"imports": "dnxcore50"
}
}
}
我得到以下异常:
最佳答案
简单的解决方案:
我的 .NET 控制台应用程序使用 .NET 4.6,并且应该引用使用 .NET Platform Standard 1.4 的核心类库。
Mapping the .NET Platform Standard to platforms表示 .NET 4.6 与 .NET Platform Standard 1.3 兼容。
将核心类库的project.json改成(节选)
"frameworks": {
"netstandard1.3": {
"imports": "dnxcore50"
}
}
解决了问题。
Here是一个说明问题的兼容性表(.NET 4.6 与 .NET Platform Standard <= 1.3 兼容):
关于c# - 无法添加对 ´ 的引用。程序集必须具有 dll 或 exe 扩展名才能被引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38341147/