Warm tip: This article is reproduced from stackoverflow.com, please click
c# entity-framework entity-framework-core nuget visual-studio

Add-Migration showing error EntityFrameworkCore.Design is not installed

发布于 2020-04-11 22:00:34

I am following the tutorial for EntityFrameworkCore in here https://docs.efproject.net/en/staging/platforms/aspnetcore/new-db.html But when i reach the create database part of the tutorial https://docs.efproject.net/en/staging/platforms/aspnetcore/new-db.html#create-your-database and run the command Add-Migration MyFirstMigration I get the following 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.

I tried to install Microsoft.EntityFrameworkCore.Design as well as Microsoft.EntityFrameworkCore.SqlServer.Design every single version there is on NuGet but still get the same error.

I also tried to run outside of the NuGet PM using the command

  • dotnet restore
  • dotnet ef migrations add MyFirstMigration

And got the following error:

Unhandled Exception: System.MissingMethodException: Entry point not found in assembly 'Microsoft.EntityFrameworkCore.Design, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.

I tried everything I could think of and looked everywhere on the internet but still came up short of an answer.

Questioner
Destino
Viewed
59
alanh 2016-11-05 02:03

Check that your project.json contains these entries

under dependencies:

"Microsoft.EntityFrameworkCore.Design": {
  "version": "1.0.0-preview2-final",
  "type": "build"
},

"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",

under tools:

"Microsoft.EntityFrameworkCore.Tools": {
  "version": "1.0.0-preview2-final",
  "imports": [
    "portable-net45+win8+dnxcore50",
    "portable-net45+win8"
  ]
},