Page 1 of 1

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

Posted: Fri 05 Jun 2015 09:57
by lavazza
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 ... force.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>
[/size]

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");

        }
    }
}
[/size]

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.

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

Posted: Fri 05 Jun 2015 10:31
by Shalex
You should also add the references to Devart.Data.dll and Devart.Data.PostgreSql.dll in your project. Does this help?

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

Posted: Fri 05 Jun 2015 10:48
by lavazza
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

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

Posted: Fri 05 Jun 2015 10:51
by lavazza
I posted my simple test case woth the problem here :

https://www.dropbox.com/s/dmf863hziax5w ... 1.zip?dl=0

I installed < dotConnect for PostgreSQL 7.3 Professional Trial > using Visual Studio 2012 patch 4

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

Posted: Fri 05 Jun 2015 11:41
by Shalex
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"

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

Posted: Sat 06 Jun 2015 12:56
by lavazza
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!