With all the various version numbering confusion of EF and .Net I think that the DevArt .dll that needs this was compiled under .Net 4.0 which will give the 5.0 EF dll the 4.4.0.0 version. If this is the case, to use EF5 there will need to be an dotConnect EF dll, is this true or am I missing something.[Could not load file or assembly 'EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Should there be an EF5 folder / dll
Should there be an EF5 folder / dll
I am trying to migrate an existing SQL Server based app targetting .Net 4.5, using EF5 to a PostGres backend using dotConnect. I have downloaded the trial version and when I try and run a migration I get the error.
Re: Should there be an EF5 folder / dll
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
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?
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.
Re: Should there be an EF5 folder / dll
Please add the reference to Entity/EF4/Devart.Data.PostgreSql.Entity.dll in your .NET 4.5 (EF5) project which uses dotConnect for PostgreSQL.
Add the following XML in the *.config file of your application to solve the problem:ACassells wrote:When I create the db in postgres and run Update-Database on 4.5 I getCode: Select all
Could not load file or assembly 'EntityFramework, Version=4.4.0.0, ...
Code: Select all
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="4.4.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Re: Should there be an EF5 folder / dll
Brilliant, thank you for that.
-
- Posts: 1
- Joined: Thu 27 Oct 2016 21:27
Re: Should there be an EF5 folder / dll
Last edited by jazz albert on Tue 07 Feb 2017 22:49, edited 1 time in total.
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Should there be an EF5 folder / dll
Please describe the issue in more details. What actions do you perform, what result do you expect, and what result do you get?