Add-Migration error showing EntityFrameworkCore.Design error not installed

I follow the tutorial for EntityFrameworkCore here https://docs.efproject.net/en/staging/platforms/aspnetcore/new-db.html But when I get part of the tutorial creation database https://docs.efproject.net/en/ staging / platforms / aspnetcore / new-db.html # create-your-database and run the Add-Migration MyFirstMigration command. 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 installing Microsoft.EntityFrameworkCore.Design as well as Microsoft.EntityFrameworkCore.SqlServer.Design every single version on NuGet, but still getting the same error.

I also tried running outside of NuGet PM using the command

  • dotnet recovery
  • dotnet ef migments 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 did not get an answer.

+6
source share
2 answers

Make sure your project.json contains these entries

in dependencies:

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

under the tools:

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

Firstly, this document using VS2015 Update2 and the current latest version for VS2015 is update 3. Therefore, I suggest you upgrade VS2015 to Update 3, which fixes a lot of VS errors.

Then, according to the manual, I get the same error message when I run the Add-Migration MyFirstMigration command. Then I run the "Install-Package Microsoft.EntityFrameworkCore.Design" command in the package manager console to install EntityFrameworkCore.Design. After installation, when I run the Add-Migration MyFirstMigration command, it was added successfully.

Below is my contents of the project.json file. Check the version of dependencies and tools. Make sure they are in the 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" }, 
+2
source

Source: https://habr.com/ru/post/1012030/


All Articles