Error : Cannot execute this command because Microsoft.EntityFrameworkCore.Design is not installed

c# entity-framework entity-framework-core

Question

I am trying to follow this tutorial: https://docs.efproject.net/en/latest/platforms/aspnetcore/existing-db.html

When I try to run :
Scaffold-DbContext "Server=myserver1;Database=mydb;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

I get this error :
Cannot execute this command because Microsoft.EntityFrameworkCore.Design is not installed. Install the version of that package that matches the installed version of Microsoft.EntityFrameworkCore and try again.

This is part of my project.json

"tools": {
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",

Any ideas?
Peter

1
2
11/9/2016 10:21:15 AM

Popular Answer

I had a similar issue I could not run add-migration from package manager console; it produced the same error. In my case lacking "type": "platform" for .netcore.app was the issue. I had to change

"Microsoft.NETCore.App": "1.1.0",
"Microsoft.EntityFrameworkCore.Design": "1.1.0",
"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final"

to

"Microsoft.NETCore.App":
{
  "version": "1.1.0",
  "type": "platform"
},
"Microsoft.EntityFrameworkCore.Design": "1.1.0",
"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final"

Then add to tools section

"tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final"
  },
3
1/4/2017 10:11:46 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow