42

I've just upgraded my solution to .NETE 4.5 using Target Framework Migrator, and then the package manager console command:

Update-Package -Reinstall -IgnoreDependencies

In one of my projects I am using:

using System.Web.Http.Controllers;
using System.Web.Http.Filters;

The code uses HttpActionContext and ReflectedHttpActionDescriptor. I notice that System.Web.Http has been removed from my references, and is no longer available in the Add New Reference window. What's going on?

3
  • Hi, this should help... stackoverflow.com/questions/9611316/… O
    – user844705
    Jan 7, 2015 at 12:07
  • 1
    @ojf already saw that question - doesn't help
    – Kev
    Jan 7, 2015 at 12:11
  • are you targeting the 4.5 Client Profile instead of the full framework maybe?
    – user844705
    Jan 7, 2015 at 12:17

4 Answers 4

81

Look in the Extensions part of the "Add new reference", instead of Framework.

If it's not there, it's in the Microsoft.AspNet.WebApi.Core package on NuGet.

2
  • Yes, I see that it's under Extensions now.
    – Kev
    Jan 7, 2015 at 14:36
  • 8
    No. It isn't. Microsoft Visual Studio likes to move things around so much it might have been there at some point. It no longer is.
    – sn0r
    Aug 6, 2018 at 10:59
33

As for Visual Studio 2017, as said in the ASP.NET forums, Microsoft has moved the namespace to a NuGet package called Web API Core.

In order to install it, you need to typeInstall-Package Microsoft.AspNet.WebApi.Core in the NuGet Package Manager Console.

2
  • 3
    Just for everybody information, it works also with VS2015. Thanks! Jan 31, 2018 at 15:38
  • 1
    This fixed my build with a new machine and VS 2019 Jan 21, 2020 at 17:35
2

Just run the following NuGet command:

Install-Package Microsoft.AspNet.WebApi.Core
1
  • Thanks! This worked for me too. This added System.Web.Http version 5.2.7.0 to my App.config file. Jun 3, 2021 at 11:37
1

I did this:

Update-Package -Reinstall

And it helped my project be well done.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.