Newtonsoft.Json Hidden Dependencny on HttpConfiguration Breaks Compilation

Today during a code review I came across an interesting compilation bug, one not expected nor anticipated. Compilation of ASP.NET MVC 4 application worked without issue, then kaboom compiler starts throwing issues Error 1818 The type or namespace name 'HttpConfiguration' could not be found on the WebApiConfig class. All references appear in good form, correct version and the WebApi Core is good. After searching for a bit, no real resolution was not worthy. For instance, just restart VS, perform clean solution and new build all works. No goods. The search continues.

Error Message

Error 1818 The type or namespace name ‘HttpConfiguration’ could not be found (are you missing a using directive or an assembly reference?) …\App_Start\WebApiConfig.cs 10 37 Framework.ReferenceTable.Web.Mvc

I started looking at what packages had the most recent version. Turns out project is referencing latest version of Newtonsoft.Json, 6.0.1. I decided to down grade to the last known version I worked with, Newtonsoft.Json 4.5.11. Abra, Kadabra, Alakazam! All compiled without error!

Tweet could not be processed

Comments