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.
EntityFrameworkCore. Design contains all the design-time logic for Entity Framework Core. It's the code that all of the various tools (PMC cmdlets like Add-Migration , dotnet ef & ef.exe ) call into. If you don't use Migrations or Reverse Engineering, you don't need it.
A plugin for Microsoft. EntityFrameworkCore to support repository, unit of work patterns, and multiple databases with distributed transaction supported. For EF Core: 2, 3.
Open the Package Manager Console from Tools → Library Package Manager → Package Manager Console and then run the enable-migrations command (make sure that the default project is the project where your context class is).
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"
]
},
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"
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With