I am working on a .Net Restful WebAPI, and it is consuming a library from another repo (I'll call the library Foo). Foo recently started using nuget Newtonsoft.Json version 11.0.2, while the WebAPI uses 10.0.2. I am getting the common error of, "Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0 ... The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"
I have tried everything that I have come across on the webs, but it is still not working.
Redirect Binding - in the WebAPI project seems to be correct (I increased the version number to see if the default of 11.0.0 was not sufficient but still not working):
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="10.0.2" />
</dependentAssembly>
- I have verified that Foo lib can run on 10.0.2 without issue.
- I have also verified that the configuration tag does NOT have a namespace
- I have verified that the assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" does have a namespace
- I have verified that the .proj has the correct version of 10.0.0 and the correct hint path
- I have verified that packages.config has the correct version of 10.0.2, and correct folder value in references
- I have verified that the solution has the correct reference block in .sln to Newtonsoft.Json
- I have verified that the Newtonsoft.Json IS in the references folder, and the version is correct
- I have tried to reinstall Newtonsoft.Json in all projects in the WebAPI via Package Mananger
- I have tried to delete the bin folder, clean the project, and rebuild
- I have tried to upgrade Newtonsoft.Json to version 11.0.2 in the WebAPI but still get an assembly not found when Newtonsoft.Json is used elsewhere in the proj.
- The WebAPI solution currently has multiple versions of Newtonsoft in separate projects. 10.0.2, 10.0.3, 11.0.2. I have tried to upgrade all projects to 11.0.2, but then get a message saying that it was looking for version 6.0.0 and couldn't find it. Not sure I think this breaks some other dependency chain.
- I have tried Nuget Package restore
- The library Foo does not have any Redirect Binding, but it doesn't seem like it would be of any use in this situation?
Any help is appreciated. I am not sure what to do next!