HttpConfiguration missing assembly

I encountered this error when cloning an MVC 4.0 application which previously worked for me. My problem was that the Microsoft.Net.Http NuGet package wasn't restoring properly. I solved it from the NuGet console:

Update-Package -reinstall Microsoft.Net.Http


I solved it. The issue was that, when I created the site, I updated all packages via Nuget. However, as I wasn´t going to use Entity Framework, I uninstalled it. In order to be able to uninstall that package, it required for me to uninstall Microsoft.AspNet.Providers.Core 1.2 as well... and I did.

This missing package messed things up. I cleared the project and started all over again. I could have also used the Update-Package command in the PM Console and would have restored all lost packages. However, since I had done so much mess compared to the little (next to null) work I had done, I decided to start it all over again.

Thanks anyway!


For others facing this issue, my solution was different. Firstly I was downgrading a project from .net 4.5 to .net 4.0, but the symptoms were the same as above:

The type or name of the assembly 'HttpConfiguration' does not exist in the namespace 'System.Web.Http' (are you missing a using directive or an assembly reference?)

I stumbled across a blog post which explained that there is a link between Newtonsoft.Json and HttpConfiguration, I removed the reference to Newtonsoft.Json from the project and the packages.config file then re-installed Newtonsoft.Json from the package manager console:

Install-Package Newtonsoft.Json

I was not able to uninstall Newtonsoft.Json from the package manage console due to other dependencies, hence the need to manually remove the reference.

Here's the link to the article: Newtonsoft.Json Hidden Dependencny on HttpConfiguration Breaks Compilation