1

System.IO.FileLoadException: Could not load file or assembly 'EntityFramework, Version=5.0.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)

App.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
  </startup>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v13.0"/>
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>
</configuration>

packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="AutoMapper" version="9.0.0" targetFramework="net462" />
  <package id="EntityFramework" version="5.0.0" targetFramework="net462" />
</packages>       

I tried to uninstall and re install EF do all the Solution hear and i can't change target framework to 5 because i use automaper

Selim Yildiz
  • 5,254
  • 6
  • 18
  • 28
Tariq Hajeer
  • 308
  • 2
  • 14

2 Answers2

1

Check a couple of things.

  • Make sure the version of EF installed supports the version of .Net you're using.
  • uninstall and reinstall
  • Make sure Nuget installed EntityFramework package
  • Make sure that all the projects are targeting the same .NET Framework.

EDIT:

Check your refrences for every EntityFramework.dll Go and check the version for each one.

Train
  • 3,420
  • 2
  • 29
  • 59
0

I have same problem, i just make sure that i am referencing the correct framework .Net in all the projects in web config

i change this

<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>

to

<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework" requirePermission="false"/>
  • I tried to uninstall and re install EF [do all the Solution](https://stackoverflow.com/questions/11749175/could-not-load-file-or-assembly-entityframework-after-downgrading-ef-5-0-0-0)hear and i can't change target framework to 5 because i use automaper – Tariq Hajeer Jan 17 '20 at 18:53
  • share source code on it git or some ware else , so that i can check. if you have no issue. – Muhammad Sufyan Jan 18 '20 at 03:17