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

后端 未结 17 2351
渐次进展
渐次进展 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:36

    Was able to solve this problem in my asp.net mvc project by updating my version of Newton.Json (old Version = 9.0.0.0 to new Version 11.0.0.0) usign Package Manager.

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

    It is possible to solve the problem by updating the 'Newtonsoft' version.

    In Visual Studio 2015 it is possible to right click on the "Solution" and select "Manage Nuget packages for solution", search for "Newtonsoft" select a more current version and click update.

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

    I had same issue with the following version 12.0.3:

    Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
    

    This issue was only in my Test project (xUnit) and was caused by lack of newtonsoft.json in this project.

    What is important, I was testing code from another project where library was attached and works properly.

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

    I am using Visual Studio 2013 Update 2. In my case, I have a web project and a Web Api project and unit test project and other class libraries in a single solution.

    I've spent couple of days to solve the problem. Below is the step-by-step solution that I have found.

    1. Right click on Web Api project. Select "Set as StartUp Project"
    2. Right click on Web Api project. Go to Properties ( Alt + Enter ).
    3. On the Application tab on left hand side menu, select Application
    4. Find Target framework. Change it to 4.5.1 and save. However, it is showing error in "Error List" window. After Rebuild, there is no error.
    5. Remove all Newtonsoft.Json packs from solution by using below query from Package Manager Console ( to get it View > Other Window > Package Manager Console ).

    uninstall-package newtonsoft.json -force

    1. Reinstall Newtonsoft.Json from Package Manager Console

    install-package newtonsoft.json

    1. If you have latest update for Visual Studio 2013, you might not encounter with this problem. As I am using Update 2, so, while trying to install Newtonsoft.Json, I have encountered with the following error.

    The 'Newtonsoft.Json 10.0.3' package requires NuGet client version '2.12' or above, but the current NuGet version i s '2.8.50313.46'

    1. To solve this problem, we need to update the Package Manager Console. Got to

    Tools > Extensions and Updates... > In left pane.. select Updates > Visual Studio Gallery.

    1. Update the NuGet Package Manager Extension. Follow the steps that are coming afterwards.

    2. Visual Studio will take a restart after that.

    3. Execute step 6 again.

    After Installation packages.config will be added with this below line

      <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net451" />
    

    After installation web.config will be added with this below lines

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

    It will execute successfully, if there is no other error.

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

    I was facing this issue when I added Nuget package Newtonsoft.Json 12.0.0.2 into my two .netstandard library projects and it grabbed almost my full day to solve this issue.

    Exception -: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified.

    Solution -: I had to remove package from Nuget and went to the following location and followed the next steps -

    Step 1. Go to location "C:\Users[UserName].nuget\packages\newtonsoft.json\12.0.2\lib" and here you will get all Nuget versions you installed previously.

    Step 2. Since i wanted to use it in my .netstandard 2.0 library project, so i copied "netstandard2.0" folder from this location and paste somewhere my preferred location (**where i generally keep 3rd party dlls).

    Step 3. Now i added DLL reference from here to my both project and this way problem solved.

    Thanks

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