The term 'Enable-Migrations' is not recognized as the name of a cmdlet, function, script file, or operable program

好久不见. 提交于 2019-12-10 13:22:31

问题


When I enter this command: 'Enable-Migrations' in Package Manager Console I get this error:

"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 p ath was included, verify that the path is correct and try again. At line:1 char:18 + Enable-Migrations <<<< + CategoryInfo : ObjectNotFound: (Enable-Migrations:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException"

I am using VS2010 with EF 4.0 and I was just doing really simple test project for deploying web site with windows azure,but for some reason I can not enable migrations.

Anyone has any idea? Thanks


回答1:


Try to restart Visual Studio. It helped in my case.




回答2:


First thing you need VS2010 Professional SP1.

After that please reinstall application package with commmand Install-Package EntityFramework -IncludePrerelease and it should solve your problem.




回答3:


If you have the latest EntityFramework and the 'Enable-Migrations' command is still showing the error reinstall/upgrade NuGet, see documentation: http://docs.nuget.org/docs/start-here/installing-nuget




回答4:


Make sure you have a solution opened. I got this error because I tried to run it without any solution opened. When I opened a solution it worked fine




回答5:


I was working on existing code-base which already had Entity Framework 5.x was installed. Some of the solutions suggested to upgrade to latest version and run but, installing the newest version remove System.Data.Entity. Adding the reference again caused errors in my old code which was using deprecated APIs.

The solution is run as administrator if you've already installed the framework in your solution




回答6:


I had this exact problem and was using an old version of NuGet, what worked for me was updating NuGet via the extensions interface.




回答7:


"Install-Package EntityFramework" will work just as well



来源:https://stackoverflow.com/questions/11202718/the-term-enable-migrations-is-not-recognized-as-the-name-of-a-cmdlet-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!