asp.net-mvc-4upshot

Adding Upshot to my MVC 4 project, problems with System.Web.Http.Common


I was trying to add upshot to my mvc 4 project.

My problem is that i am needed to add System.Json and System.Web.Http.Common to get

@(Html.UpshotContext(bufferChanges: true).DataSource<S_Innovations.TrafficTheory.Web2.APIControllers.TheoryTestsController>(x => x.GetTheoryTests()))

working.

After adding Json i get Could not load file or assembly 'System.Web.Http.Common, and when i add this i cant compile.

Error   15  The type 'System.Web.Http.RouteParameter' exists in both 'g:\Documents\Visual Studio 2012\Projects\S-Innovations.TrafficTheory\packages\System.Web.Http.Common.4.0.20126.16343\lib\net40\System.Web.Http.Common.dll' and 'g:\Documents\Visual Studio 2012\Projects\S-Innovations.TrafficTheory\packages\Microsoft.AspNet.WebApi.Core.4.0.20710.0\lib\net40\System.Web.Http.dll' G:\Documents\Visual Studio 2012\Projects\S-Innovations.TrafficTheory\S-Innovations.TrafficTheory.Web2\App_Start\WebApiConfig.cs 19

Solution

  • The problem is that you have 2 different references to the System.Web.Http.dll. Once from the System.Web.Http.Common package and the other from the Microsoft.AspNet.WebApi.Core pakage.

    I think you will have to remove one of the packages and it will work. An other thing you can do is look in the reference folder and search for the duplicate reference.