1
votes

I want to update the Newtonsoft.Json dll from version 6.0.0.0 to version 8.0.0.0. I also refer to System.Net.Http.Formatting.dll version 5.2.3.0. It is internally referring to Newtonsoft.Json dll version 6.0.0.0. enter image description here

Hence i'm getting below error: System.IO.FileNotFoundException : Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

Tried assembly binding and added below in app.config

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

Still facing same issue.

2
What version of .net framework are you targeting?Black Frog
@BlackFrog : .Net Framework 4.7.1Vivek Palasseri
Change your old version in binding redirects to: oldVersion="0.0.0.0-8.0.0.0". After that change your build output verbosity in Tools > Options > Projects and Solutions > Build and Run to Detailed or Diagnostic to verify, why build is picking incorrect version.Peska
Version 5.2.3 of that package hasn’t been updated since 2015. I will take a deeper look once I get to my desk.Black Frog

2 Answers

1
votes

Based on the Nuget Gallery page, "System.Net.Http.Formatting" (link) does not depend on "Newtonsoft.JSON". Please view the attached screenshot / link.

enter image description here

I would recommend re-installing packages to resolve the errors:

Update-Package -reinstall -Project ProjectName

0
votes

Looking at the picture you added, you have two Formatting dll. The 5.2.3 version wasn’t packaged correctly. It has a hard reference to version 6.0 of Newtonsoft.Json. Even the description of the package has misspelled word. I am suspecting the spec in the package is incorrect.

enter image description here