问题
I'm trying to run for the first time in my new mvc 4 application PM> Enable-Migrations –EnableAutomaticMigrations
I'm geting:
Enable-Migrations : The term 'Enable-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.
At line:1 char:1
+ Enable-Migrations –EnableAutomaticMigrations
What am I missing? I have installed e.f 5.
回答1:
Try typing in Package Manager Console:
Install-Package EntityFramework -IncludePrerelease
and then Restart Visual Studio.
回答2:
First "Install-Package EntityFramework -IncludePrerelease" and then Restarting Visual Studio as a Administrator worked for me together.
[Refer this] : Package Manager Console Enable-Migrations CommandNotFoundException only in a specific VS project
回答3:
I had the framework installed (5.x) and retried running the same commands after running in admin mode. This has resolved the issue -- quite strange though.
回答4:
You have to make sure that you don't have any square brackets "[" in your path directory of the project. Apparently VS 2013 is not happy with project folders named with square brackets.
来源:https://stackoverflow.com/questions/17363059/the-term-enable-migrations-is-not-recognized-mvc-code-first