Add-Migration showing error EntityFrameworkCore.Design is not installed

c# entity-framework entity-framework-core nuget visual-studio

Question

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.

1
8
11/4/2016 1:02:32 PM

Accepted Answer

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"
  ]
},
5
11/4/2016 6:03:31 PM

Popular Answer

First, this document using VS2015 Update2 and current latest version for VS2015 is Update 3. So I suggest you upgrade your VS2015 to Update 3, which has fixed a lot of VS bugs.

Then according to the tutorial, I get the same error message when I run the command Add-Migration MyFirstMigration. Then I run command "Install-Package Microsoft.EntityFrameworkCore.Design" in Package Manager Console to install the EntityFrameworkCore.Design. After install it, when I run the command Add-Migration MyFirstMigration, it added successful.

Following is my project.json file content. Please check the dependencies and tools version. Make sure they are in correct versions.

"dependencies": {
"Microsoft.NETCore.App": {
  "version": "1.0.0",
  "type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview3-final",
"Microsoft.EntityFrameworkCore.Design": "1.0.1"
},

"tools": {
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},


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