Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.(5)

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

ITtutoria

ITtutoria Logo ITtutoria Logo

ITtutoria Navigation

  • Python
  • Java
  • Reactjs
  • JavaScript
  • R
  • PySpark
  • MYSQL
  • Pandas
  • QA
  • C++
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA
Home/ Questions/How to deal with the could not load file or assembly newtonsoft json errors?
Next
Answered
Aditya Martin
  • 33
Aditya Martin
Asked: May 18, 20222022-05-18T16:37:34+00:00 2022-05-18T16:37:34+00:00In: Programs

How to deal with the could not load file or assembly newtonsoft json errors?

  • 33

. Advertisement .

..3..

. Advertisement .

..4..

Hi developer experts,
I have a small but frustrating use case, and so far, I couldn’t get my head around this problem & ideal solution. I am running my command and facing one problem with the could not load file or assembly newtonsoft json.
Below is the command I used:

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

When I run it, I get the following error:

System.IO.FileLoadException : 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)

I am looking forward to gaining some knowledge from all experts.
Thank you, guys!

assembly newtonsoft json
  • 2 2 Answers
  • 49 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook
  • Report

2 Answers

  • Voted
  • Oldest
  • Recent
  • Random
  1. Best Answer
    hdtutoria Expert
    2022-06-10T10:37:02+00:00Added an answer on June 10, 2022 at 10:37 am

    The cause: The error message claims that Newtonsoft version 4.5.0.0, Newtonsoft.Json is currently at version 6.0.0.0, hence the redirect should be from 4.5 to 6.0, not vice versa. not the other way around.

    The solution: You can fix this error by adding the following binding redirect to your .config file:

    <runtime>
        . . .
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed"
                    culture="neutral" />
                <bindingRedirect oldVersion="4.5.0.0" newVersion="6.0.0.0" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
    • 13
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  2. Zoé Guerin
    2022-05-25T20:32:24+00:00Added an answer on May 25, 2022 at 8:32 pm

    Update-Package –reinstall Newtonsoft.Json is a Update-Package –reinstall Newtonsoft.Json-specific option in the package manager console.


    UPDATE


    I posted this originally as a comment, but @OwenBlacker suggested that I just post it here:

    If you get an error still after this, I deleted Json.Net’s <dependentAssembly> from my .config. If it isn’t there, you can reinstall it. Otherwise, it will be deleted. This manual step is necessary until there is an automatic solution in the package.

    Please note: Before you do this, please read the comments.

    Rene’s comment in BE AWAREN states that the command in the answer will reinstall your package in all projects in your solution. If you are using the Newtonsoft.Json package for multiple projects, and possibly use different versions of the package, the above command may have unwelcome consequences.

    • 5
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question
  • How to Split String by space in C++
  • How To Convert A Pandas DataFrame Column To A List
  • How to Replace Multiple Characters in A String in Python?
  • How To Remove Special Characters From String Python

Explore

  • Home
  • Tutorial

Footer

ITtutoria

ITtutoria

This website is user friendly and will facilitate transferring knowledge. It would be useful for a self-initiated learning process.

@ ITTutoria Co Ltd.

Tutorial

  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA

Legal Stuff

  • About Us
  • Terms of Use
  • Privacy Policy
  • Contact Us

DMCA.com Protection Status

Help

  • Knowledge Base
  • Support

Follow

© 2022 Ittutoria. All Rights Reserved.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.