无法解决目标框架'DNX,Version = v4.5.1'的以下依赖关系 [英] Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1'
问题描述
我使用的是ASP.NET 5.0,我想只在新的Core CLR上运行,因此我从<中删除了 dnx451:{}
code> project.json 文件。在IIS中启动时,我现在得到以下错误:
I'm using ASP.NET 5.0 and I wanted to run just on the new Core CLR, so I removed "dnx451": { }
from dependencies in my project.json
file. I now get the following error when I launch in IIS:
无法解决目标框架'DNX,Version = v4的以下依赖关系。 5.1':
Microsoft.AspNet.Mvc 6.0.0-beta4
Microsoft.AspNet.Server.IIS 1.0.0-beta4
Microsoft.AspNet.Server.WebListener 1.0.0-beta4
Microsoft.AspNet.StaticFiles 1.0.0-beta4
Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1': Microsoft.AspNet.Mvc 6.0.0-beta4 Microsoft.AspNet.Server.IIS 1.0.0-beta4 Microsoft.AspNet.Server.WebListener 1.0.0-beta4 Microsoft.AspNet.StaticFiles 1.0.0-beta4
我的理解是AspNet.Mvc 6将在Core CLR上运行?为什么然后我必须包含 dnx451
作为依赖项?
My understanding was that AspNet.Mvc 6 would run on Core CLR? Why then do I have to include dnx451
as a dependency?
我的 project.json
文件:
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Mvc": "6.0.0-beta4",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta4"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000"
},
"frameworks": {
"dnxcore50": { }
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
]
}
推荐答案
在 project.json
中将 dnxcore50
指定为依赖项不是与告诉解决方案以 dnx
为目标相同。为了解决这个问题,我不得不修改解决方案 global.json
文件以使用 dnx
的特定版本(即特定的.Net可执行文件)。我还不得不更改一些 using
语句,以使用新的Core CLR库而不是.Net 4.5库。您将获得有关这些信息的智能感知和错误警告。
Specifying dnxcore50
as a dependency in project.json
is not the same as telling the Solution to target that dnx
. To fix this I had to modify the solution global.json
file to use a specific version of the dnx
(i.e. a specific .Net executable). I also had to change a few using
statements to use new Core CLR libraries instead of .Net 4.5 libraries. You will get intellisense and error warnings about these.
global.json
文件可在解决方案节点下找到。我必须添加sdk版本部分:
The global.json
file can be found under the Solution node. I had to add the sdk version part:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta4"
}
}
请注意,您也可以在GUI中进行编辑:
Note that you can also edit this in a GUI:
强烈推荐最近上传的ASP.NET简介和ASP.NET深入介绍可以在第9频道。
Strongly recommend the recently uploaded ASP.NET Introduction and ASP.NET Deep Dive videos from Build 2015 available on Channel 9.
这篇关于无法解决目标框架'DNX,Version = v4.5.1'的以下依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!