1
votes

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

2
What version of .net? I see you've installed it for 4.6.2 but what are you using?Train
i'm sure i'm use .net 4.6.2Tariq Hajeer

2 Answers

1
votes

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.

0
votes

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"/>