Reputation: 159
I am getting the below error when i am trying to do a simple application using ASP.NET 5 RC1. Kindly help me with the issue. Not sure, where i am making the mistake :( Kindly do the needful. Thanks a lot for your help in advance.
{
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel"
},
"dependencies": {
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final"
},
"exclude": [
"wwwroot",
"node_modules"
],
"frameworks": {
"dnx451": {
"dependencies": {
"Microsoft.AspNet.Mvc.Core": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final"
}
},
"dnxcore50": {
"dependencies": { }
}
},
"publishExclude": [
"**.user",
"**.vspscc"
],
"version": "1.0.0-*",
"webroot": "wwwroot"
}
Startup.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Framework.DependencyInjection;
namespace MVA5
{
public class Startup
{
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(Microsoft.Extensions.DependencyInjection.IServiceCollection services)
{
services.AddMvc();
}
public void Configure(IApplicationBuilder app)
{
// Add the platform handler to the request pipeline.
app.UseIISPlatformHandler();
app.UseMvcWithDefaultRoute();
//app.Run(async (context) =>
//{
// await context.Response.WriteAsync("Hello World!");
//});
}
}
}
DNVM List
Upvotes: 1
Views: 981
Reputation: 57989
You have 2 target frameworks(TFMs or target framework monikers) listed in your project.json
: dnx451
and dnxcore50
. So when you do a build, its built for both of these frameworks.
Now since you have the dependency of "Microsoft.AspNet.Mvc"
listed only as part of dnx451
, when doing a build for dnxcore50
the build is failing (I agree that from error list may be its not very clear).
Try moving both the "Microsoft.AspNet.Mvc.Core"
and "Microsoft.AspNet.Mvc"
dependencies to the dependencies
node common to both the TFMs and then do a build.
Upvotes: 4
Reputation: 4010
Make sure that you use 1.0.0-rc1-final runtime.
For that type into console: dnvm list
If you don't use 1.0.0-rc1-final runtime, type into console: dnvm upgrade.
Upvotes: 1