Could not load file or assembly 'Devart.Data.PostgreSql.Entity, Version=7.4.422.6...

Could not load file or assembly 'Devart.Data.PostgreSql.Entity, Version=7.4.422.6...

Postby lavazza » Fri 05 Jun 2015 09:57

Hello,

I downloaded and installed dotConnect for Postgres trial in order to test Code First functionnality.

I created a simple app following the article:
http://blog.devart.com/entity-framework-6-support-for-oracle-mysql-postgresql-sqlite-and-salesforce.html

My program dos not work:
System.IO.FileLoadException: Could not load file or assembly 'Devart.Data.PostgreSql.Entity, Version=7.4.422.6, Culture=neutral, PublicKeyToken=09af7300eec23701' or one of the dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Did I forget semething ?

Here is my app.config file:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="entityFramework"
             type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
             requirePermission="false" />
  </configSections>
  <connectionStrings>
    <add name="PostgresQL" connectionString="server=srvubuntu01;user id=postgres;password=postgres;database=MeteodynPSQL.MeteodynContext" providerName="PSQLprovider" />
  </connectionStrings>
  <entityFramework>
    <providers>
      <provider invariantName="PSQLprovider"
      type="Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices, Devart.Data.PostgreSql.Entity, Version=7.4.422.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </providers>
  </entityFramework>
</configuration>


The program:
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Devart.Data.PostgreSql.Entity;
using System.Data.Entity;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var context = new DbContext("PostgresQL");

        }
    }
}


In the ConsoleApplicatin.csproj, the dependencies are:

Code: Select all
[size=85] <ItemGroup>
    <Reference Include="Devart.Data.PostgreSql.Entity, Version=7.3.422.6, Culture=neutral, PublicKeyToken=09af7300eec23701, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\..\..\..\..\Program Files (x86)\Devart\dotConnect\PostgreSQL\Entity\EF6\Devart.Data.PostgreSql.Entity.dll</HintPath>
    </Reference>
    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
      <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
      <HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.ComponentModel.DataAnnotations" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>[/size]


I removed Devart.Data.PostgreSql.Entity from the Global Assembly Cache because it was EF5's version that was referenced.
But I still have the problem.
lavazza
 
Posts: 4
Joined: Fri 05 Jun 2015 08:38

Re: Could not load file or assembly 'Devart.Data.PostgreSql.Entity, Version=7.4.422.6...

Postby Shalex » Fri 05 Jun 2015 10:31

You should also add the references to Devart.Data.dll and Devart.Data.PostgreSql.dll in your project. Does this help?
Shalex
Devart Team
 
Posts: 7780
Joined: Thu 14 Aug 2008 12:44

Re: Could not load file or assembly 'Devart.Data.PostgreSql.Entity, Version=7.4.422.6...

Postby lavazza » Fri 05 Jun 2015 10:48

No does not.

Isn't a version problem ?

Why is it installed by default with EF5 version in the GAC ?
Devart.Data.PostgreSql.Entity, Version=7.3.422.0, Culture=neutral, PublicKeyToken=09af7300eec23701, processorArchitecture=MSIL
lavazza
 
Posts: 4
Joined: Fri 05 Jun 2015 08:38

Re: Could not load file or assembly 'Devart.Data.PostgreSql.Entity, Version=7.4.422.6...

Postby lavazza » Fri 05 Jun 2015 10:51

I posted my simple test case woth the problem here :

https://www.dropbox.com/s/dmf863hziax5wnb/ConsoleApplication1.zip?dl=0

I installed < dotConnect for PostgreSQL 7.3 Professional Trial > using Visual Studio 2012 patch 4
lavazza
 
Posts: 4
Joined: Fri 05 Jun 2015 08:38

Re: Could not load file or assembly 'Devart.Data.PostgreSql.Entity, Version=7.4.422.6...

Postby Shalex » Fri 05 Jun 2015 11:41

1. You have set the 7.4.422.6 version in App.config, but it should be 7.3.422.6.

2. In case of EF6, the references to Devart.* assemblies:
"C:\Program Files (x86)\Devart\dotConnect\PostgreSQL\Devart.Data.dll"
"C:\Program Files (x86)\Devart\dotConnect\PostgreSQL\Devart.Data.PostgreSql.dll"
"C:\Program Files (x86)\Devart\dotConnect\PostgreSQL\Entity\EF6\Devart.Data.PostgreSql.Entity.dll"
Shalex
Devart Team
 
Posts: 7780
Joined: Thu 14 Aug 2008 12:44

Re: Could not load file or assembly 'Devart.Data.PostgreSql.Entity, Version=7.4.422.6...

Postby lavazza » Sat 06 Jun 2015 12:56

Shalex wrote:1. You have set the 7.4.422.6 version in App.config, but it should be 7.3.422.6.


That was exactly the error. Thank you very much ! I could finally make a code first postgresql database.

Problem solved!
lavazza
 
Posts: 4
Joined: Fri 05 Jun 2015 08:38


Return to dotConnect for PostgreSQL