Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity framework Mapping API referencing error

I'm trying to use third party package for Bulk insert in entity framework: EntityFramework.BulkInsert

Problem is that my project uses Entity Framework mapping 5.0.0.9 and when I run 3rd party package I get an error:

Could not load file or assembly 'EntityFramework.MappingAPI, Version=5.0.0.6, Culture=neutral, PublicKeyToken=7ee2e825d201459e' or one of its dependencies.

On packages page it says that all versions between 5.0.0.6 and 6.0.0.0 are supported. So I guess I should just somehow change the version it uses, but I don't know how. Any suggestions?

like image 660
jozhe Avatar asked Mar 10 '26 01:03

jozhe


1 Answers

You have to add a binding redirect to the web or app config file to tell the framework that when a lower version of the dependent assembly is required, it should load your desired version instead. It would be something like this:

 <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="EntityFramework.MappingAPI" culture="neutral" publicKeyToken="7ee2e825d201459e" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.9" newVersion="5.0.0.9" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
like image 88
Francesc Castells Avatar answered Mar 12 '26 13:03

Francesc Castells



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!