我创建了一个ASP.NET Core RC2类库,在project.json上我有:
div
我在ASP.Net Core RC2 Web应用程序上使用它,project.json有:
"frameworks": {
"net461": { },
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-3002702"
}
},
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
}
注意:为简单起见,我省略了其他依赖项。
尝试还原Web项目时出现以下错误:
"dependencies": {
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"TestLibrary": "1.0.0",
},
"frameworks": {
"net461": { }
},
我错过了什么?
更新
我将TestLibrary配置更改为:
The dependency TestLibrary 1.0.0 does not support framework .NETFramework,Version=v4.6.1.
但我有一个带有测试的类库项目名称TestLibraryTests:
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027",
},
"frameworks": {
"netstandard1.5": {
"imports": [
"dnxcore50",
"portable-net452+win81"
]
}
}
但现在我收到了错误:
"testRunner": "xunit",
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027",
"xunit": "2.2.0-beta1-build3239",
"dotnet-test-xunit": "1.0.0-rc2-build10015",
"TestLibrary": "1.0.0"
},
"frameworks": {
"netstandard1.5": {
"imports": [
"dnxcore50",
"portable-net452+win81"
]
}
}
我错过了什么?我不能将XUnit与RC2一起使用?
答案 0 :(得分:1)
当我尝试直接使用软件包而不安装.NET Core RC2时,我得到了同样的错误:)
博文: https://blogs.msdn.microsoft.com/dotnet/2016/05/16/announcing-net-core-rc2/
答案 1 :(得分:1)
添加类库包时,请确保选择.NET Core - >类库,同时确保从下面图像中带红色的下拉列表中选择正确的目标框架。
你的project.json应该是这样的:
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",
"NETStandard.Library": "1.5.0-rc2-24027"
},
"frameworks": {
"netstandard1.5": {
"imports": [
"dnxcore50",
"portable-net452+win81"
]
}
}
}