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

前端 未结 26 829
无人共我
无人共我 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:05

    I solved by updateing Package Manager Console.

    I was not getting Update-Database in Package Manager Console. Then i restart several time. Also restart Windows.

    Then I download new one from nuget and then it was solved.

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

    In my case:

    • Reload project did not help
    • Restart VS did not help
    • Restart computer did not help
    • Reinstal EF did not help

    But I found an article where suggestion was to manualy import missing EF package, using PM Conole:

    Import-Module .\packages\EntityFramework.X.X.X\tools\EntityFramework.psm1

    And this solution solved my problem.

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

    you will get this error when the EF tools are not installed properly.

    try the below command in Nuget package manager //Uninstalls and install the same Version of EF

    Update-Package "EntityFramework" -reinstall
    

    If you still face the same issue. create a new Web Project and run the below command in nuget.

    (Note : no need to create the new Project in the same solution or same location.)

    // This will update EF to latest version(including the tools) // if you want to use specific version , use the -version flag.

    Update-Package "EntityFramework"
    

    Once this is done, chcek your original project and you can delete the newly created project.

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

    Sometimes when I load VS, I see this in my package manager console:

    Value cannot be null.

    Parameter name: path1

    I have no idea what causes that yet but it seems that something goes wrong during the start-up of the Powershell console which interrupts the registering of specific modules, such as the EF powershell extensions. You can just manually load it however:

    Import-Module .\packages\EntityFramework.6.1.1\tools\EntityFramework.psm1
    

    Make sure you replace 6.1.1 with whatever your current version of Entity Framework is.

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

    Just restart Visual Studio, it'll solve the problem. Works for me.

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

    For me the problem was the Nuget version.

    1. uninstall Nuget Package Manager.
    2. restart Visual Studio.
    3. installed new version of Nuget Package Manager.
    4. then re-start Visual Studio again.
    0 讨论(0)
提交回复
热议问题