Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies

前端 未结 10 2806
独厮守ぢ
独厮守ぢ 2021-02-20 10:31

First, It is not just duplicate. None of answers from following questions are working for me.

http://goo.gl/tS40cn
http://goo.gl/pH6v2T

I\'ve just updated al

相关标签:
10条回答
  • 2021-02-20 10:33
    1. In your VS solution explorer, remove the Newtonsoft.Json reference.
    2. Download the 6.0 binary files at Newtonsoft binary files here
    3. Extract the files
    4. Add the Newtonsoft library manually. From Visual Studio, right click Reference and select Add Reference
    5. Click Browse
    6. Navigate to the extracted files under Net45 and select Newtonsoft.Json.dll
    7. If it does not work try using Net40 instead by going through the whole procedure again.
    0 讨论(0)
  • 2021-02-20 10:40

    Add Newtonsoft reference in my MVC project solves the problem for me.

    0 讨论(0)
  • 2021-02-20 10:43

    After trying much of the above (and some other posts), I uninstalled with the package manager all of the following from the project affected:

    Microsoft.AspNet.WebApi
    Microsoft.AspNet.Client
    Microsoft.AspNet.Core
    Microsoft.AspNet.WebHost
    Newtonsoft.Json
    

    Then reinstalled Microsoft.AspNet.WebApi, which auto installed .Client, .Core, .WebHost, .Json.

    0 讨论(0)
  • 2021-02-20 10:46

    check the 'Newtonsoft.Json' version in the project references. Add that version in the Web config. It will work. For Example: your Webconfig look like this:

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

    If your version in References is '9.0.0.0' change to this:

    <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json"publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="9.0.0.0"/>
    </dependentAssembly>
    
    0 讨论(0)
  • 2021-02-20 10:47

    I know this is old, but I just ran into the same problem. My issue was that multiple projects in the solution used Newtonsoft.Json, but some were at different versions. I updated all of them to the most recent (9.0.1 as I type) and the problem went away.

    Anyway... if anyone is still dealing with this, make sure to update the package in EVERY project in the solution.

    HTH

    0 讨论(0)
  • 2021-02-20 10:51

    In my case, the following code was present in my local debug version of the solution, but not in my live server version of code. Adding the code to my server Web.config file fixed the problem.

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

    0 讨论(0)
提交回复
热议问题