Thursday, February 20, 2014

Solving System.Web.Http.GlobalConfiguration' does not contain a definition for 'Configure

When upgrading your fantastic Asp.Net Web Api projects to version 2.0, you might come across this wonderful error -

System.Web.Http.GlobalConfiguration' does not contain a definition for 'Configure 
on this line of code -
GlobalConfiguration.Configure(WebApiConfig.Register);

The solution is quick and simple.

1. Open the Package Manager Console for the project with the error.
2. Type in Install-Package Microsoft.AspNet.WebApi.WebHost and hit Enter
3. Rebuild your project and all should be right with the world (or at least right with your project)


Smooches,
Kila