rbasniak
rbasniak

Reputation: 4974

Package manager console Add-Migration command not working

First of all, all other questions here with this problem are for ASP.NET Core projects, and the solution is to add the Microsoft.EntityFrameworkCore.Design to the tools section on project.json, but... I'm not using ASP.NET Core, so I don't have project.json in my project. So please keep it in mind before marking it as duplicate since I saw that's a fairly common question...

When I type add-migration InitialMigration on Package Manager Console 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.

But as you can see on the image bellow, it is installed on this project:

enter image description here

My database layer is in a separated project, which is Full Framework ClassLibrary, and because of this I don't have a projec.json file.

Does anyone tried to use migrations on class libraries projects?

Upvotes: 2

Views: 14830

Answers (1)

Maritim
Maritim

Reputation: 2159

In dotnet core this is typically due to the fact that you're missing a package. Go into the NuGet Package Manager on the solution level and install Microsoft.EntityFrameworkCore.Tools for your project.

enter image description here

Upvotes: 7

Related Questions