15

Any idea why I receive the following error after Nuget installing Entity framework 6.1.3?

Error notice: "The dependency EntityFramework 6.1.3 in project foo bar does not support framework .NETPlatform,Version=v5.4"

Here's my global.json (edited out personal data)

{
  "version": "1.0.0-*",
  "description": foo bar Class Library",
  "authors": [ "foo bar" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",
  "frameworks": {
    "net451": { },
    "dotnet5.4": {
      "dependencies": {
        "Microsoft.CSharp": "4.0.1-beta-23516",
        "System.Collections": "4.0.11-beta-23516",
        "System.Linq": "4.0.1-beta-23516",
        "System.Runtime": "4.0.21-beta-23516",
        "System.Threading": "4.0.11-beta-23516"
      }
    }
  },
  "dependencies": {
    "EntityFramework": "6.1.3"
  }
}
Tiny
  • 27,221
  • 105
  • 339
  • 599
JrD
  • 161
  • 1
  • 5
  • 4
    What is that `dotnet5.4` in your json? Are you from the future? – Fede Dec 15 '15 at 20:28
  • 2
    @Fede, that is .Net Platform 5.4. No sure which EF version supports this platform. – Don Dec 28 '15 at 04:00
  • https://www.google.com/search?q=.net+5.4&oq=.net+5.4&aqs=chrome..69i57.2371j0j4&sourceid=chrome&es_sm=122&ie=UTF-8#q=latest+.net+framework @Fede Latest .Net Framework version is 4.6 Lol – zackery.fix Dec 28 '15 at 04:32

5 Answers5

9

I solved by deleting this line - "net451": { },, and then replacing "dotnet5.4" with "net451".

Don
  • 1,532
  • 4
  • 24
  • 47
  • Worked like a charm. I guess it was just an old project template (since the codenames were renamed a few times). I also had "net451" (for the full framework) which was replaced by "dnx451" (no side effects). – drizin Mar 03 '16 at 23:42
  • Can someone tell me how to prevent this in future projects, I had the same problem – Mohit Shah Jun 28 '16 at 07:47
2

I had a same issue with EF7 and I was able to solve it by changing dotnet54 to netcore50 in project.json in my EF library and every project depending on it.

Martin Vich
  • 1,062
  • 1
  • 7
  • 22
2

I solved it by just cutting the

"dependencies": { "EntityFramework": "6.1.3" }

dependencies into .Net4.51

"net451": {
  "dependencies": {
    "EntityFramework": "6.1.3",
    "Microsoft.AspNet.Identity.Core": "2.2.1",
    "Microsoft.AspNet.Identity.EntityFramework": "2.2.1"
  }

Final Look

    {
  "version": "1.0.0-*",
  "description": "EMS.Identity Class Library",
  "authors": [ "SamuelA" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",
  "frameworks": {
    "net451": {
      "dependencies": {
        "EntityFramework": "6.1.3",
        "Microsoft.AspNet.Identity.Core": "2.2.1",
        "Microsoft.AspNet.Identity.EntityFramework": "2.2.1"
      }
    },
    "dotnet5.4": {
      "dependencies": {
        "Microsoft.CSharp": "4.0.1-beta-23516",
        "System.Collections": "4.0.11-beta-23516",
        "System.Linq": "4.0.1-beta-23516",
        "System.Runtime": "4.0.21-beta-23516",
        "System.Threading": "4.0.11-beta-23516"
      }
    }
  }
}
zx485
  • 28,498
  • 28
  • 50
  • 59
sam akosh
  • 21
  • 1
0

I quickly fixed a similar issue by manually editing the project.json file.

Note: Let me mention that my solution is Asp.net 5.0 Web Application and is targeting DNX 4.5.1

It was:

{
  "version": "1.0.0-*",
  "description": "DataLayer Class Library",
  "authors": [ "local-admin" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",
  "frameworks": {
    "net451": { },
    "dotnet5.4": {
      "dependencies": {
        "Microsoft.CSharp": "4.0.1-beta-23516",
        "System.Collections": "4.0.11-beta-23516",
        "System.Linq": "4.0.1-beta-23516",
        "System.Runtime": "4.0.21-beta-23516",
        "System.Threading": "4.0.11-beta-23516"
      }
    }
  },
  "dependencies": {
    "EntityFramework": "6.1.3"
  }
}

I replaced the frameworks section and became:

{
  "version": "1.0.0-*",
  "description": "DataLayer Class Library",
  "authors": [ "local-admin" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",
  "frameworks": {
    "dnx451": { }
  },
  "dependencies": {
    "EntityFramework": "6.1.3"
  }
}
cnom
  • 3,071
  • 4
  • 30
  • 60
0

I had a same issue then i was able to solve it by deleting the obj folder of the particular project file.

srbh
  • 1
  • 2