Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I manage EF 6 migrations in visual studio 2015?

I started a new MVC project with EntityFramework -Version 6.1.2 using Visual Studio 2013 latest update. I made a couple of migrations and updated the database. After this I checked out the project on another computer and opened with Visual Studio 2015 CTP 6.

If I go in the package manager console and try to run any migration commands, they're not recognized:

add-migrations : The term 'add-migrations' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

How can I manage my migrations using Entity Framework 6 in Visual Studio 2015?

like image 992
Luca Morelli Avatar asked Mar 04 '15 13:03

Luca Morelli


2 Answers

Have you tried uninstalling and reinstalling EntityFramwork NuGet package? I had the same issue as described and it solved it.

like image 150
Damien Chaib Avatar answered Sep 30 '22 07:09

Damien Chaib


OK so I had this problem with an EF6 project I started in VS2013 and upgraded to VS2015 RC. The commands were available if I opened it in VS2013 but not in VS2015. What I found to solve the problem quickly and easily was to use the reinstall package command:

Update-Package –reinstall EntityFramework

This fixed any command missing errors and then allowed me to start database updates and create new migrations within VS2015.

like image 31
Richard Avatar answered Sep 30 '22 06:09

Richard