启用迁移错误 - 对象重新启动,MigrationsDomainCommand

use*_*040 6 entity-framework ef-migrations

我有一个MVC 4项目,最近升级到EF 6.0.我只有一个包含模型和dbcontext的项目.我无法启用迁移,错误如下:

System.NullReferenceException: Object reference not set to an instance of an object. at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue[T](Project project, String propertyName) at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName, Boolean useContextWorkingDirectory) at System.Data.Entity.Migrations.EnableMigrationsCommand.FindContextToEnable(String contextTypeName) at System.Data.Entity.Migrations.EnableMigrationsCommand.<>c__DisplayClass2.<.ctor>b__0() at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command) Object reference not set to an instance of an object.

谷歌搜索过去2天的答案,似乎没有任何作用.请帮我.

Gig*_*m02 9

本周,当我的高级开发人员将解决方案更新为EF6时,我遇到了同样的问题.

从源代码管理中获取"获取最新"后,迁移不再起作用.Visual Studio重新启动解决了该问题.可能EF5库仍在内存中.

  • 在从源代码管理中获取最新资源后,重新启动VS也为我工作.但是它与升级到EF6无关 (3认同)

mod*_*eeb 1

我看到有人说你需要以管理员身份运行Visual Studio。我尝试了一下并且成功了。