Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies

后端 未结 17 2349
渐次进展
渐次进展 2020-12-03 00:43

I have a WinJS project that is previously built on Windows 8.1 using VS 2013.

Recently I upgraded this project to Universal Windows 10 by creating a blank Javascrip

相关标签:
17条回答
  • 2020-12-03 01:21

    I've experienced similar problems with my ASP.NET Core projects. What happens is that the .config file in the bin/debug-folder is generated with this:

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

    If I manually change the second bindingRedirect to this it works:

    <bindingRedirect oldVersion="9.0.0.0" newVersion="10.0.0.0" />
    

    Not sure why this happens.

    I'm using Visual Studio 2015 with .Net Core SDK 1.0.0-preview2-1-003177.

    0 讨论(0)
  • 2020-12-03 01:25

    I solved this issue by removing all the NuGet packages from solution and reinstalling them. One of the NuGet Packages was dependent upon NewtonSoft and it was not showing in references

    0 讨论(0)
  • 2020-12-03 01:28

    I had a similar problem with a new ASP.NET Core application a while ago. Turns out one of the referenced libraries used a version of Newtonsoft.Json that was lower than 9.0.0.0. So I upgraded the version for that library and the problem was solved. Not sure if you'll be able to do the same here

    0 讨论(0)
  • 2020-12-03 01:29

    I solved this problem by adding Newtonsoft.Json to the NuGet of the startup project.

    0 讨论(0)
  • 2020-12-03 01:29

    One need to update Newtonsoft.Json -Version GO to Tools => NuGet Package Manager => Package Manager Console and Type Install-Package Newtonsoft.Json -Version 12.0.2 in Package Manager Console Window.

    0 讨论(0)
  • 2020-12-03 01:29

    In my case it was an issue with the configuration file web.config on my machine when I updated the newton version VS automatically fixed my web.config file to point to the new version. When I uploaded it to production the existing web.config was pointing to the old version.

    Once I updated the web.config it started working again.

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
      </dependentAssembly>
    
    0 讨论(0)
提交回复
热议问题