I tried to run the command \'Enable-Migrations\' in a new project and I got the message:
PM> Enable-Migrations
The term \'Enable-Migrations\' is not recog
Enable-Migrations -EnableAutomaticMigrations
In VS 2013, try to install the UPDATE 1(RC1) and the problem is resolved.
I had the same issue and I tried most of the solution provided by other folks but it worked for me with below steps. I have VS 2017.
Steps:
Install-Package EntityFramework -IncludePrerelease
then create a class as
public class MyDBContext : DbContext { public MyDBContext() { } }
and at the last execute
Enable-Migrations -EnableAutomaticMigrations
What didn't work for me:
: Restarting VS.
: only "Enable-Migrations" command, which is without -EnableAutomaticMigrations.
: restoring or updating Nuget Package Manager.
My original error in the beginning was
/* The term 'enable-migration' 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.At line:1 char:1 + enable-migration + ~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (enable-migration:String) [], CommandNotFoundException */
I just had the same problem in asp.net core VS2019
This solved it:
Install-Package Microsoft.EntityFrameworkCoreInstall-Package
Install-Package Microsoft.EntityFrameworkCore.Tools
Don't forget to set default project in Package Manager Console to your database project in case it differs.
While executing the migrations the default project also seems to play a role. At a later step it helped to install this to my main startup project (not the EF database project):
Install-Package Microsoft.EntityFrameworkCore.Design
Install Entity framework to the current project using the below command: PM> Install-Package EntityFramework -IncludePrerelease
Add a class "MyDBContext" in the Model folder as given below:
public class MyDBContext : DbContext { public MyDBContext() { } }
Now enable migrations for the current project with the below command: PM> enable-migrations
Check the version of the Entity Framework.
if it is 6.3, downgrade it to 6.2 and it should work just fine