JsonSubTypes is giving me a huge headache. I had to update that and Newtonsoft.Json in a large solution with many projects. One of those projects has a related unit-test project. Both projects rely on JSON objects and both projects have references to Newtonsoft.Json and JsonSubTypes. I updated Newtonsfot.Json to version 13.0.0 and JsonSubTypes to version 1.8.0.
When I run the unit tests, one of the tests (using JSON) fails with the exception thrown:
System.IO.FileLoadException: Could not load file or assembly 'JsonSubTypes, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Notice the 1.5.0 version here (when the one I'm trying to use is 1.8.0).
I've already tried advice from other StackOverflow posts. I tried opening the app.config
and packages.config
files for both projects and they contain the correct, updated versions and also point to packages in the Nuget packages folder.
I tried adding binding redirect for JsonSubTypes (0.0.0.0-1.8.0.0 in both projects).
I tried clean and rebuild the solution.
I tried looking at the loaded modules (in the Modules window) when executing the unit tests, right before the step when the exception is thrown, but couldn't see any JsonSubTypes assemblies being loaded at all.
I searched the local disk for all JsonSubTypes files, found a package folder with the old 1.5.0 version, removed it and Visual Studio still threw the same error. Seems like it doesn't even care about the actual assembly and just checks some config somewhere and I can't seem to find that config.