无法添加对的引用´。程序集必须具有dll或exe扩展名才能被引用 [英] A reference to could not be added ´. An assembly must have a dll or exe extension in order to be referenced
问题描述
我有一个普通的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 。
I have plain c# console application (.NET 4.6) where I want to reference a .NET Core Class Library:
{
"version": "1.0.0-*",
"dependencies": {
"NETStandard.Library": "1.6.0",
"Newtonsoft.Json": "9.0.1"
},
"frameworks": {
"netstandard1.4": {
"imports": "dnxcore50"
}
}
}
And I get the following exception:
Simple solution:
My .NET console application uses .NET 4.6 and should reference a Core Class Library using .NET Platform Standard 1.4.
Mapping the .NET Platform Standard to platforms says that .NET 4.6 is compatible with .NET Platform Standard 1.3.
Changing the project.json of the Core Class Library to (excerpt)
"frameworks": {
"netstandard1.3": {
"imports": "dnxcore50"
}
}
solved the problem.
Here is a compatibility table demonstrating the problem (.NET 4.6 is compatible with .NET Platform Standard <= 1.3):
这篇关于无法添加对的引用´。程序集必须具有dll或exe扩展名才能被引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!