Failed to resolve the following dependencies for target infrastructure 'DNX, Version = v4.5.1'

I am using ASP.NET 5.0 and I only wanted to run in the new Core CLR, so I removed "dnx451": { } from the dependencies in my project.json file. Now I get the following error when starting in IIS:

The following dependencies could not be resolved for the target structure '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

As far as I understand, AspNet.Mvc 6 will work in Core CLR? Why then should I include dnx451 as a dependency?

My project.json file:

 { "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" ] } 
+3
asp.net-core .net-core
source share
2 answers

Setting dnxcore50 as dependencies in project.json is not the same as telling Solution about dnx targeting. To fix this, I had to modify the global.json solution global.json to use a specific version of dnx (i.e. a specific .Net executable). I also had to modify several using statements to use the new base CLR libraries instead of .Net 4.5 libraries. You will receive error warnings and error warnings.

The global.json file can be found in the section Solution node. I had to add part of the sdk version:

 { "projects": [ "src", "test" ], "sdk": { "version": "1.0.0-beta4" } } 

Please note that you can also edit this in the GUI:

enter image description here

We strongly recommend the recently downloaded ASP.NET and ASP.NET Deep Dive videos from version 2015, available on Channel 9 .

+2
source share

I had this error while publishing my DNX web application. It turned out that this was because I upgraded from Beta5 to Beta6, but neglected to update my powershell script publication, which looks like this:

 $thisFolder = (Get-Item -Path ".\" -Verbose).FullName $webFolder = "$thisFolder\..\src\Web.UI" dnu publish $webFolder ` --out \\uatserver\uatshare ` --configuration DEBUG ` --no-source ` --runtime dnx-clr-win-x64.1.0.0-beta5 

So, in the last parameter, my publication still said that it targets beta5 instead of beta6.

0
source share

All Articles