无法解决目标框架'DNX,Version = v4.5.1'的以下依赖关系

编程入门 行业动态 更新时间:2024-10-06 06:52:31
本文介绍了无法解决目标框架'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 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'的以下依赖关系

本文发布于:2023-11-12 21:10:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582534.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:框架   目标   关系   DNX   Version

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!