. Advertisement .
..3..
. Advertisement .
..4..
I am trying to write a csharp that returns an invalid answer. I don’t know where the incorrect command is in the “could not load file or assembly ‘newtonsoft.json version=12.0.0.0.”
My detail is:
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
and I end up with the warning message:
System.IO.FileNotFoundException: 'Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified.'
Pls, suggest the best answer to fix it.
The cause: The cause of this error is that a version incompatibility. It says in your error that the library version “12.0.0.0” could not be found. The version stated in your configuration reference is “12.0.3.”
Solution: You can fix this error by uninstalling the nugets, checking in, reinstalling them and building (and checking in again)
In my case, I installed V 12.0.0.3 using the Nuget package. I received the same error. Based on my personal experience, Some NewtonSoft version are having trouble with Visual Studio.
If you only require deserialize or serialize functionality you can solve your problem by reinstalling the Newtonsoft current solution and installing the version 6.0.3
This version is compatible with different versions of visual studio.