To follow up on this, I have created 2 identical projects in VS2012. One of them targeting .Net 4.0 the other targeting .Net 4.5.
The 4.0 project, when you install Entity Framework adds a reference to a EF .dll 4.4.0.0
The 4.5 project, when you install Entity Framework adds a reference to a EF .dll 5.0.0.0
I have created a simple entity and context, enabled and added a migration, and set the SqlGenerator to be PgSqlEntityMigrationSqlGenerator on both projects.
When I create the db in postgres and run Update-Database on 4.0 I get the desired tables created.
When I create the db in postgres and run Update-Database on 4.5 I get
Code: Select all
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at Ef_Postgres_4_5_Test.Migrations.Configuration..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.CreateConfiguration(Type configurationType)
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.FindConfiguration()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator()
at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.RunCore()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
Exception has been thrown by the target of an invocation.
I think there is an obvious issue with EF5 migrations on .Net 4.5 . I am more than happy to share these 2 test projects. Is this a known issue or is there any work around?