我正在使用 VS 2015。
Your project is not referencing the ".NETFramework,Version=4.5" framework. Add a reference to ".NETFramework,Version=4.5" in the "frameworks" section of your project.json, and then re-run NuGet restore.
在添加到我的 MVC 层后不久,我在数据访问和业务逻辑层上收到此错误。在那之前一切都很好,但我不知道是什么触发了这个错误。这是我的 project.json:
{
"version": "1.0.0-*",
"description": "foo bar Class Library",
"authors": [ "foo bar" ],
"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"
}
}
}
}
这是我尝试过的:
结果是同样的错误。
Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win":{} }' to your project.json and then re-run NuGet restore.
我尝试按照此错误的建议进行操作并添加
"runtimes": {
"win": {}
},
这给了我这个错误,我似乎无法超越:
Your project.json doesn't list 'win' as a targeted runtime. You should add '"win": {}' inside your "runtimes" section in your project.json, and then re-run NuGet restore.
我已经添加了“win”,这开始让人感觉像是一条红鲱鱼。我在做什么直接改变 project.json,NuGet 不是在处理这个吗?
最佳答案
我遇到了同样的问题,最后我不仅要删除 bin
和 obj
文件夹的内容,还要删除 .vs
解决方案的目录。
关于.net - 您的项目未引用 ".NETFramework,Version=v4.5"框架。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36190601/