6

I have an asp.net web api application in which I have this line :

using System.Web.Http.Results;

My problem is that the namespace isn't recognized, I verified the dll system.Web.Http exists in the bin folder !!

So I need to know:

  • What is the reason of this problem?
  • How can I fix it?
Jester
  • 56,577
  • 4
  • 81
  • 125
Lamloumi Afif
  • 8,941
  • 26
  • 98
  • 191

3 Answers3

10

You need reinstalling the NuGet package, which corrects broken dependencies. Open package manager and run Update-Package Microsoft.AspNet.WebApi -reinstall.

Mihai Alexandru-Ionut
  • 47,092
  • 13
  • 101
  • 128
0

The above solution didn't work for me as it was failing on some other package too. My solution was to delete the packages folder and rebuild the project, which retrieved all the packages again.

ViqMontana
  • 5,090
  • 3
  • 19
  • 54
0

I think I got around this problem by installing the following package using NuGet:

Install-Package Microsoft.AspNet.WebApi.Core

I followed these two answers from here: https://stackoverflow.com/a/49448133/2048391 and https://forums.asp.net/t/2096814.aspx?

jyrkim
  • 2,849
  • 1
  • 24
  • 33