The term 'Update-Database' is not recognized as the name of a cmdlet

前端 未结 26 830
无人共我
无人共我 2020-12-07 19:35

I am using EF5 beta1 and while I was able to run the \"Update-Database\" before. Now that I shut down Visual Studio, I cannot get it to run. I get the following error:

相关标签:
26条回答
  • 2020-12-07 20:19

    If you use Entity Framework:

    Error Message: "Error Message (from the Update-Database command in the PMC): The term 'Update-Database' 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."

    Solution: Exit Visual Studio. Reopen project and try again.

    For more information please visit: Advanced Entity Framework 6 Scenarios for an MVC 5 Web Application (12 of 12)

    Hope this helps...

    0 讨论(0)
  • 2020-12-07 20:19

    In my case, I did the following: - restored missing NuGet packages by clicking "Restore" button on top of the Package Manager Console - restarted Visual Studio - run update-database

    0 讨论(0)
  • 2020-12-07 20:21

    Simple fix for me was to make sure there was a dash between update and database, like this: update-database and use lowercase. It may be coincidental, but when I did this in Packet Manager Console, the database actually updated and I got the done message rather than the not recognized as the name of a cmdlet, function, script file error.

    0 讨论(0)
  • 2020-12-07 20:22

    I had this same problem, and the origin of it was on my path name, I had on my path a directory name with straight brackets, like this: C:\[PROJ]\TestApp.

    When I removed the brackets, to C:\PROJ\TestApp, it started to work just fine...

    0 讨论(0)
  • 2020-12-07 20:23

    Reinstalling the nuget package fixed this issue for me

    ie, execute

    Install-Package EntityFramework -Version 5.0.0
    

    in the package manager

    0 讨论(0)
  • 2020-12-07 20:23

    For anyone who is using .Net Core and EntityFrameworkCore:

    You will need to install Microsoft.EntityFrameworkCore.Tools package to resolve this issue.

    Read more here: https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell

    0 讨论(0)
提交回复
热议问题