相关文章推荐
紧张的火龙果  ·  Perform grouped joins ...·  1 年前    · 
销魂的烈马  ·  jboss CLI ...·  1 年前    · 
调皮的石榴  ·  Laravel ...·  1 年前    · 
忧郁的豆芽  ·  Emacs Verilog mode ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I have to add a System.Web.Http assembly reference because I added the HttpConfiguration class to my unit test class library project.

When I browse the Add reference dialog I can not find the System.Web.Http assembly.

The class library project has the .Net 4.5.1 Framework targeted.

In order to get the System.Web.Http you will need to install a NuGet package in the NuGet command line:

Install-Package Microsoft.AspNet.WebApi.Core

https://www.nuget.org/packages/Microsoft.AspNet.WebApi.Core/

that drove me crazy.... I must be thinking wrong but anything that starts with the namespace "System" seems like it shouldnt have to be installed via a nuget package. – Todd Vance Jun 7, 2016 at 14:26 When working with multiple solutions / projects, be sure to select the right solution in the package manager console to install the package to; this had me confused for a bit. – Zimano Mar 14, 2019 at 13:42 I had to use Install-Package Microsoft.AspNet.WebApi.Client -Version 5.2.7 instead (.Client instead of .Core). I had .Core 5.2.7 already, but I was still getting the error. nuget.org/packages/Microsoft.AspNet.WebApi.Client – user224567893 Dec 22, 2020 at 20:10

I've had multiple errors regarding missing references such as "system.web.http" or "system.web.razor" in my project. Even though I do have all the references installed through nuget.

What worked for me was to install a standalone version of AspNetMVC4, even though Visual Studio 2014 installed that as well. Apparently it was missing some references in Windows. I've installed this from the Microsoft website, and all went well afterwards.

Hope this helps someone. It drove me crazy for like 2 days, nothing regarding nuget worked for me, I've deleted and reinstalled the references a couple times, did everything I've found in multiple posts on stackoverflow, nothing worked.

Url for mvc4 standalone setup from microsoft: https://www.microsoft.com/en-us/download/confirmation.aspx?id=30683

My variant for VS 2017: use NuGet and downgrade a version of Microsoft.AspNet.WebApi.Core; then re-install the right version. Accept Licenses (which is probably what was needed). Important: close and reopen visual studio. Fixed. – Stan Aug 15, 2020 at 14:06

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.