update-database error - NuGet Package (EntityFrame

2019-02-12 04:09发布

i installed EntityFramework.SqlMigrations NuGet Package and i get this error . it worked for me in the past and somehow, now it does not work.

PM> update-database
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.
At line:1 char:16
+ update-database <<<< 
    + CategoryInfo          : ObjectNotFound: (update-database:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

7条回答
看我几分像从前
2楼-- · 2019-02-12 04:25

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
查看更多
太酷不给撩
3楼-- · 2019-02-12 04:27

In my case, helped installing EntityFramework package first:

Install-Package EntityFramework

and then installing EntityFramework.Migrations again:

Install-Package EntityFramework.Migrations
查看更多
我命由我不由天
4楼-- · 2019-02-12 04:36

Restarting Visual Studio solved the problem for me...

查看更多
倾城 Initia
5楼-- · 2019-02-12 04:38

I just used this command:

Update-Package EntityFramework -Reinstall
查看更多
地球回转人心会变
6楼-- · 2019-02-12 04:44

Occurs with EF5 RTM, VS2012 RTM.

I experienced this problem today. I executed "Update-Package EntityFramework" in the PM Console. No changes were reported by NuGet and the problem persisted. I then restarted VS2012 and re-attempted Update-Database and it worked as expected. It's not clear what caused this problem, it's also not clear whether the Update-Package contributed to correcting it or not.

First try restarting Visual Studio, then try Update-Package EntityFramework followed by a restart.

查看更多
Viruses.
7楼-- · 2019-02-12 04:44

After trying everything else, the only way I could get my EntityFramework Migrations commands back was to run the following from the "Package Manager Console":

Import-Module \*PathToSolution*\packages\EntityFramework.5.0.0-beta2\tools\EntityFramework.psd1

After running the above, Add-Migration, Update-Database, etc. was available again.

查看更多
登录 后发表回答