Monday, March 28, 2016

The dependency Microsoft.AspNet.Mvc >= 6.0.0-rc1-final could not be resolved.

I got this error when adding MVC to my ASP.NET 5 project.   My project.json contained the following dependencies, and I was getting an error that it couldn't resolve the second one.

  "dependencies": {
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final"
  },

The error I was getting was:

The dependency Microsoft.AspNet.Mvc >= 6.0.0-rc1-final could not be resolved.

Fix:

It turned out that I just needed to run "dnvm upgrade " from my command prompt with VS closed.

Once I'd run this command, VS then resolved the dependency correctly.