40

I've just upgraded my solution to .net 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?

Kev
  • 2,626
  • 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

79

Have you looked 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.

Steen Tøttrup
  • 3,715
  • 2
  • 19
  • 33
  • 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 VS2017 - 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.

Ezra Steinmetz
  • 1,207
  • 17
  • 18
2

Just run the following nuget command:

Install-Package Microsoft.AspNet.WebApi.Core
d219
  • 2,503
  • 5
  • 27
  • 33
Vinay Patel
  • 111
  • 2
1

I do this

Update-Package -Reinstall 

and it helped to my project be well done