1

I have a ASP.Net MVC sub-application that uses EntityFramework 6.2.0 and .Net Framework 4.6.1

This web app runs as a sub app to an older ASP.Net MVC site that uses EF5. When I try to run the sub-app I am getting the error:

ExceptionMessage=An error occurred creating the configuration section handler for entityFramework: 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)

I assume I have to do something with dependent assembly configuration in the sub-app's web.config AssemblyBinding section. I've had to do similar things with "System.Web.Http" and "System.Web.Http.WebHost" but EntityFramework seems like it might be a bit different.

Do I just add

<dependentAssembly>
    <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
    <bindingRedirect oldVersion="1.0.0.0-6.2.0.0" newVersion="6.2.0.0" />
  </dependentAssembly>

Or is there more to it for EF?

John S
  • 7,909
  • 21
  • 77
  • 145
  • [Could not load file or assembly or one of its dependencie](https://stackoverflow.com/questions/4469929/could-not-load-file-or-assembly-or-one-of-its-dependencies) – OlegI Sep 14 '18 at 13:53

1 Answers1

0

Resolved by adding to the web.Config

<dependentAssembly>
    <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
    <bindingRedirect oldVersion="1.0.0.0-6.2.0.0" newVersion="6.2.0.0" />
  </dependentAssembly>
John S
  • 7,909
  • 21
  • 77
  • 145