Entity framework 更新数据库错误-NuGet包(EntityFramework.SqlMigrations)

Entity framework 更新数据库错误-NuGet包(EntityFramework.SqlMigrations),entity-framework,nuget-package,entity-framework-migrations,Entity Framework,Nuget Package,Entity Framework Migrations,我安装了EntityFramework.SqlMigrations NuGet软件包 我得到了这个错误。 它在过去对我有效,但不知怎么的,现在不起作用了 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 i

我安装了EntityFramework.SqlMigrations NuGet软件包 我得到了这个错误。 它在过去对我有效,但不知怎么的,现在不起作用了

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
PM>更新数据库
术语“更新数据库”不能识别为cmdlet、函数、脚本文件或可操作程序的名称。检查名称的拼写,或者如果包含路径,请验证
路径正确,请重试。
第1行字符:16

+更新数据库在我的例子中,首先帮助安装EntityFramework包:

Install-Package EntityFramework
然后安装EntityFramework。再次迁移:

Install-Package EntityFramework.Migrations

不是最好的解决方案,但为了让它再次工作,我必须重新安装EntityFramework.Migrations包。在重新应用Init.ps1之后,它记住了所有命令。

在尝试了所有其他操作之后,我可以恢复EntityFramework迁移命令的唯一方法是从“Package Manager控制台”运行以下命令:


运行上述操作后,添加迁移、更新数据库等功能再次可用。

与EF5 RTM、VS2012 RTM一起出现

我今天遇到了这个问题。我在PM控制台中执行了“更新包EntityFramework”。NuGet未报告任何更改,问题仍然存在。然后我重新启动了VS2012,并重新尝试更新数据库,结果一切正常。不清楚是什么导致了这个问题,也不清楚更新包是否有助于纠正这个问题


首先尝试重新启动Visual Studio,然后尝试更新包EntityFramework,然后重新启动。

重新启动Visual Studio为我解决了问题…

我刚刚使用了以下命令:

Update-Package EntityFramework -Reinstall

对我来说,问题在于Nuget版本

  • 卸载Nuget包管理器
  • 重新启动VisualStudio
  • 已安装Nuget软件包管理器的新版本
  • 然后重新启动Visual Studio

  • 这并没有解决我的问题。此外,包“EntityFramework.Migrations”不再发布,因此此解决方案可能仅对“5.0-pre”包有效。+1,重新启动成功,因此看起来不需要
    更新包EntityFramework
    。我认为人们正在经历两个不同的问题,它们以相同的方式表现出来。有些人实际上需要强制更新包(例如,管理不善的解决方案是从源代码管理中提取的,带有挥之不去的EF工件),而其他人则发现PM控制台无法正确初始化EF模块/cmdlet的错误。
    Update-Package EntityFramework -Reinstall