I have already used an entity framework with separate migration package(for 3.5 or 4.0, don't remember), and with included migrations api(4.3, 5.0).
But today i have created a new project(empty MVC4.0 project), install latest stable EF(4.3) and recieve error below on the "pm > Add-Migration initital" command
System.Runtime.Serialization.SerializationException: Type is not resolved for member 'System.Data.Entity.Migrations.Design.ToolingFacade+GetPendingMigrationsRunner,EntityFramework , Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
at System.Data.Entity.Migrations.Design.ToolingFacade.GetPendingMigrations()
at System.Data.Entity.Migrations.AddMigrationCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Then i am trying to switch to EF5.0 and an error still here, with one difference in a version:
System.Runtime.Serialization.SerializationException: Type is not resolved for member 'System.Data.Entity.Migrations.Design.ToolingFacade+GetPendingMigrationsRunner,EntityFramework , Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
It is first time when i recieve this error. The
"System.Data.Entity.Migrations.Design.ToolingFacade" class exists and the "GetPendingMigrationsRunner " subclass in it also exists in a referenced EntityFramework assembly.
Anyone knows what may cause an error? Migrations works ok for another project on MVC4.0, on those i have choosen standart(not empty) project template.
Thanks!
I was able to fix this error by right clicking on the class library that contained my migrations, and selecting "Set as StartUp Project"
Source: http://forums.asp.net/t/1978562.aspx?Getting+exception+while+running+EF+Migrations+command+in+Package+Manager+Console
I got the same error when trying to Enable-Migrations in a solution where some projects were targetting .NET 4.5 (hence using EF 5) and some were targetting .NET 4 (hence using EF 4.4). It seems that it was trying to load the wrong version of the EF DLL.
When I temporarily un-loaded the .NET 4.5 projects from my solution, I could then successfully use Enable-Migrations in my other projects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With