Unable to debug web project due to wrong DLL version ... pulled from dependent project
After re-organizing the projects of a solution, the web app failed to start in the debugger with an error that it could not load Newtonsoft.Json.dll. The error indicated that it could a file of that name, but it was not the expected version. Sure enough the file version of the DLL was 6. But, the project was setup to pull version 10 via nuget. Further, if I deleted the DLL from the bin dir and built (F6), the file version was 10. But, when I started the debugger, that version was overwritten with version 6. That was frustrating. The build was doing different things based on how I invoked it.
After some hunting around and finding different possible causes and solutions, I discovered that one of them matched what was happening to me. Version 6 of the DLL was pulled in by a dependent project - called Common. That version then made its way into the Web project when it built ... with the intent to debug. So, the fix was to setup Common for version 10. After that, I could debug the web project. Yeah!
Note that Common was previously _not_ setup to pull Newtonsoft.Json.dll. It was setup for another package (nlog 4.4.4) that probably depends on Newtonsoft.Json.dll v6. But, once I setup Common for Newtonsoft.Json.dll v10, then it pulled that version. And fortunately, nlog seems to be compatible.
After some hunting around and finding different possible causes and solutions, I discovered that one of them matched what was happening to me. Version 6 of the DLL was pulled in by a dependent project - called Common. That version then made its way into the Web project when it built ... with the intent to debug. So, the fix was to setup Common for version 10. After that, I could debug the web project. Yeah!
Note that Common was previously _not_ setup to pull Newtonsoft.Json.dll. It was setup for another package (nlog 4.4.4) that probably depends on Newtonsoft.Json.dll v6. But, once I setup Common for Newtonsoft.Json.dll v10, then it pulled that version. And fortunately, nlog seems to be compatible.
Comments
Post a Comment