I am getting this annoying error when running a webapi application. I am using newton JSON - version 9.01.
{"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)":"Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed"}
My project .netFramework is 4.0. To help solve this issue I had added a dependency assembly:
<assemblyIdentity name="Newtonsoft.Json"
publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
and my project package.config
<package id="Newtonsoft.Json" version="9.0.0.0" targetFramework="net40" />
Both are equal but I am still getting error. Why is this happening? This is strange because my error message shows different assembly version. I have already updated newtonjson 9.0.0 and am using it, but the error throws differently. I have tried installing newtonjson 6.0.0, and then the package manager console is throwing an error:
Unable to find version '6.0.1' of package 'Newtonsoft.Json'.
Sometimes when downgrading to a lower version newton json, C# dependency is not supported already or installed like it shows. What should I do? I am very new in installing nuget pakages . Your help is appreciated.