Error running code first migration update-database

asp.net-web-api c# entity-framework

Question

Im having trouble with my migration to my database and i can't seem to find a answer to the error i am getting

 System.MissingMethodException: Method not found: 'System.Data.Entity.Migrations.Builders.TableBuilder`1 System.Data.Entity.Migrations.Builders.TableBuilder`1.Index(System.Linq.Expressions.Expression`1>, Boolean, Boolean, System.Object)'.
   at Evento.Migrations.initialcreate.Up()
   at System.Data.Entity.Migrations.DbMigrator.ApplyMigration(DbMigration migration, DbMigration lastMigration)
   at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ApplyMigration(DbMigration migration, DbMigration lastMigration)
   at System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
   at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
   at System.Data.Entity.Migrations.DbMigrator.UpdateInternal(String targetMigration)
   at System.Data.Entity.Migrations.DbMigrator.c__DisplayClassc.b__b()
   at System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
   at System.Data.Entity.Migrations.Infrastructure.MigratorBase.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
   at System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration)
   at System.Data.Entity.Migrations.Infrastructure.MigratorBase.Update(String targetMigration)
   at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.Run()
   at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
   at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
   at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
   at System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force)
   at System.Data.Entity.Migrations.UpdateDatabaseCommand.c__DisplayClass2.b__0()
   at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Method not found: 'System.Data.Entity.Migrations.Builders.TableBuilder`1 System.Data.Entity.Migrations.Builders.TableBuilder`1.Index(System.Linq.Expressions.Expression`1>, Boolean, Boolean, System.Object)'. 
1
10
3/25/2014 4:36:14 PM

Accepted Answer

I ran into this same issue and here is how I resolved it. I hope this helps someone else.

  1. I deleted Entity Framework from my References and removed the lines from my package.config file(s).
  2. Closed Visual Studio and deleted all the EntityFramework DLL files in my project folders
  3. Opened Visual Studio, then did a Clean and Build
  4. Re-install Entity Framework
  5. Did a Clean and Build again

After that, it was working.

16
6/24/2014 1:46:06 PM

Popular Answer

This can happen if you are running an older version of migrate.exe against a new dll using EF 6.2.0



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow