Have two separate versions of a dll

1

I have a web form application that have all business logic in a separate dll with it's own project. The dll need to have two different version of Newtonsoft.json. I have tried using the following code in both the websites web.config and the dll app.config file but I can't get the application to load the dll:s from my specified folder. I still gets the message:

"Could not load file or assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

Any ideas on what I might be doing wrong?

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <!--<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />-->

    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken ="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="4.5.0.0" newVersion="5.0.1.0" />
    <bindingRedirect oldVersion="5.0.2.0-99.0.0.0" newVersion="7.0.1.0" />
    <codeBase version="4.5.0.0" href="Bin/Newtonsoft.Json/5.0.1.0/Newtonsoft.Json.dll" />
    <codeBase version="5.0.1.0" href="Bin/Newtonsoft.Json/5.0.1.0/Newtonsoft.Json.dll" />
    <codeBase version="7.0.1.0" href="Bin/Newtonsoft.Json/7.0.1.18622/Newtonsoft.Json.dll" />

    <!--<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="7.0.1.0" />-->

  </dependentAssembly>
</assemblyBinding>

SOLVED: Add the following in both webconfig and appconfig <bindingRedirect oldVersion="0.0.0.0-99.0.0.0" newVersion="7.0.1.0" />

.net
dll
asked on Stack Overflow Aug 16, 2016 by user1454695 • edited Dec 2, 2019 by Cœur

1 Answer

1

Add the following in both webconfig and appconfig <bindingRedirect oldVersion="0.0.0.0-99.0.0.0" newVersion="7.0.1.0" />

answered on Stack Overflow Sep 3, 2016 by user1454695

User contributions licensed under CC BY-SA 3.0