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?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Kev
  • 2,656
  • 3
  • 39
  • 63
  • Hi, this should help... http://stackoverflow.com/questions/9611316/system-net-http-missing-from-namespace-using-net-4-5 O –  Jan 07 '15 at 12:07
  • 1
    @ojf already saw that question - doesn't help – Kev Jan 07 '15 at 12:11
  • are you targeting the 4.5 Client Profile instead of the full framework maybe? –  Jan 07 '15 at 12:17

4 Answers4

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Steen Tøttrup
  • 3,755
  • 2
  • 22
  • 36
  • Yes, I see that it's under Extensions now. – Kev Jan 07 '15 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 06 '18 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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ezra Steinmetz
  • 1,267
  • 1
  • 17
  • 18
2

Just run the following NuGet command:

Install-Package Microsoft.AspNet.WebApi.Core
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Vinay Patel
  • 131
  • 1
  • 3
1

I did this:

Update-Package -Reinstall

And it helped my project be well done.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131