Geetika Wadhwa
Geetika Wadhwa

Reputation: 39

Could not load file or assembly 'System.Web.Http' or one of its dependencies

I have created an empty project in MVC 4 with .Net Framework 4.5 and integrated with sitecore When I tried to run the project getting below error:

Could not load file or assembly 'System.Web.Http' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040

Upvotes: 1

Views: 1205

Answers (4)

Vinod Parmar
Vinod Parmar

Reputation: 15

Resolved :

You need the Microsoft.AspNet.WebApi.Core package.

To install Microsoft ASP.NET Web API 2.2 Core Libraries, run the following command in the Package Manager Console

PM> Install-Package Microsoft.AspNet.WebApi.Core and you could add the below line before your class declaration

using System.Web.Http;

Hope its working for you.

Upvotes: 1

Geetika Wadhwa
Geetika Wadhwa

Reputation: 39

Thanks everyone for your reply! Actually, I am using Sitecore 8 in VS 2012 which is not having MVC5. So after installing MVC5 package in VS2012, it works fine !

Upvotes: 0

Varun Nehra
Varun Nehra

Reputation: 379

This happens when your system assemblies from the sitecore install get replaced by a different version from your build. Make sure you set your system assemblies to "do not copy" in your project if they already exist in the sitecore bin.

Upvotes: 0

Jason Bert
Jason Bert

Reputation: 782

You may need to add in some assembly binding redirects, although that's not usually one to redirect. As you haven't stated which Sitecore version you're running you may be trying to use older/newer assemblies compared to the Sitecore install. It's probable that you're using older binaries, Sitecore 8, 7.5 & 7.2 use MVC 5.

Upvotes: 1

Related Questions