我正在尝试为ASP.NET Core创建一个Onion Architecture项目。我遇到了引用类库和仅在Build期间出现的其他错误的一些问题。从下图中,第一个问题似乎是DataAnnotations,我添加了System.ComponentModel.Annotations(没有找到旧版本System.ComponentModel.DataAnnotations)但错误说我没有4.5.1版本,我确实安装了5.4版本......我需要两者吗? 第二个问题与LINQ查询有关,抱怨缺少System.Runtime。
我在LifeLine.Core中的project.json如下:
{
"version": "1.0.0-*",
"description": "LifeLine.Core Class Library",
"authors": [ "212040799" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"net451": { },
"dotnet5.4": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516"
}
}
},
"dependencies": {
"System.ComponentModel.Annotations": "4.0.11-beta-23516"
}
}
我在LifeLine.Infrastructure中的project.json如下:
{
"version": "1.0.0-*",
"description": "LifeLine.Infrastructure Class Library",
"authors": [ "212040799" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"net451": { },
"dotnet5.4": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516"
}
}
},
"dependencies": {
"EntityFramework.Core": "7.0.0-rc1-final",
"LifeLine.Core": "1.0.0-*"
}
}
答案 0 :(得分:0)
即使这是一个“类库包”'项目,虽然我不得不将Microsoft.AspNet.Mvc添加到它。