Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The current runtime target framework is not compatible with project

I am attempting to perform an initial migration after adding Entity Framework 7 to my Asp.Net 5 project. I am following this documentation.

In my project.json I have specified:

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel",
    "ef": "EntityFramework.Commands"
  },

  "frameworks": {
    "dnxcore50": { }
  }

I am attempting to execute the following command in the project directory via a command prompt:

dnx ef migrations add MyFirstMigration

But I get the following error:

System.InvalidOperationException: The current runtime target framework is not compatible with ProjectName. The current runtime target framework: 'DNX, Version=v 4.5.1(dnx451) Please make sure the runtime matches a framework specified in project.json.

The weird thing is that my project.json is definitely targeting dnxcore50. I have also checked in global.json:

{
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-beta8",
    "architecture": "x86",
    "runtime": "coreclr"
  }
}

And my package dependencies all reference beta8:

  "dependencies": {
    "EntityFramework.Commands": "7.0.0-beta8",
    "EntityFramework.Core": "7.0.0-beta8",
    "EntityFramework.SqlServer": "7.0.0-beta8",
    "Hl7.Fhir.DSTU2": "0.90.2",
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta8",
    "Microsoft.AspNet.Authentication.OpenIdConnect": "1.0.0-beta8",
    "Microsoft.AspNet.Diagnostics": "1.0.0-beta8",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-beta8",
    "Microsoft.AspNet.Mvc": "6.0.0-beta8",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta8",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-beta8",
    "Microsoft.AspNet.StaticFiles": "1.0.0-beta8",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-beta8",
    "Microsoft.Dnx.Runtime": "1.0.0-beta8",
    "Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
    "Microsoft.Framework.Configuration.UserSecrets": "1.0.0-beta8",
    "Microsoft.Framework.Logging": "1.0.0-beta8",
    "Microsoft.Framework.Logging.Console": "1.0.0-beta8",
    "Microsoft.Framework.Logging.Debug": "1.0.0-beta8",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta8"
  }
like image 747
Blake Mumford Avatar asked Nov 12 '15 06:11

Blake Mumford


1 Answers

You need to either add dnx451 to your project's supported frameworks, or switch to a .NET Core version.

  "frameworks": {
    "dnxcore50": { },
    "dnx451": { }
  }

Or run:

dnvm install latest -r coreclr

or

dnvm use default -r coreclr

like image 50
natemcmaster Avatar answered Sep 24 '22 04:09

natemcmaster