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
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.
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"
]
},
This one worked for me and I was able to use the Add-Migration with succes on app and web application, the problem is that my Context is in a library and the 1.0.0-preview2-final is not compatible with the NETStandard.Library, god knows why. I am using a workaround right now and compiling my library as an command app, and it is working so far. Still I hope that microsoft updates their library and documentation soon, this is far away from my desired architecture.
@Destino Feel free to mark as answer since it fixed your problem.