MREFBUILDER : error : Unresolved assembly reference: Newtonsoft.Json on OOTB Project Template

Topics: Developer Forum
Mar 24, 2014 at 8:33 AM
Yesterday I added a reference to System.Web.Http to my project in order to use WebApi, and I started getting the following error when building my SHFB project:
MREFBUILDER : error : Unresolved assembly reference: Newtonsoft.Json (Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed) required by System.Web.Http [D:\Desktop\Help\Working\GenerateRefInfo.proj]
I have tracked the problem down to being specific to the version of the Newtonsoft.Json library within the project, and I can easily reproduce this problem with an out of the box project template in Visual Studio with the following steps:
  1. In Visual Studio (2013), create a new ASP.NET project using the WebApi template. Choose .NET version 4.5.1.
  2. Build the project and create a generic SHFB project against the solution. This should work and compile the help file.
  3. Go to Nuget package manager and upgrade all the packages to the latest versions with the "Update All" button. This will upgrade Newtonsoft.Json from version 5.x to version 6.x.
  4. Rebuild the help file in SHFB. This should cause the error to appear.
There Visual Studio project itself compiles, runs and deploys without issue and there is a version of the Newtonsoft.Json library in the project so I can't see why SHFB can't resolve this dependency reference. I'm obviously somewhat disinclined to downgrade the version of the library I'm using just for this reason, so hoping you guys have some bright ideas for how to solve this problem!
Coordinator
Mar 24, 2014 at 3:40 PM
Add the Assembly Binding Redirection plug-in to the project and configure it to point the older version of the Newtonsoft.Json library at the newer version. If there are binding redirections in a Web.config, you can specify it and the plug-in will use the ones in the configuration file.

Eric
Mar 24, 2014 at 11:47 PM
Thanks so much for the speedy and accurate response. That solved my problem and my project is building again. I'm a happy bunny.
Jul 29, 2014 at 4:45 PM
The link to the assembly binding redirection plugin does not works.
Coordinator
Jul 29, 2014 at 11:57 PM
You can still find it in the TOC or with the search option. The new link is here: http://ewoodruff.us/shfbdocs/html/f5051d32-b973-4fe1-9ffe-e30531007691.htm