Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type or namespace name "HTTP" doesn't exist in the namespace system.web error in .net 4.6.2

I am new to .net/C#. I am trying to build a project but getting a lot of missing reference error. When I am trying to install the packages like mentioned in example, I am getting error that it already exists in the project.

PM> Install-Package Microsoft.AspNet.WebApi.Core
Package 'Microsoft.AspNet.WebApi.Core.5.2.7' already exists in project 'XXXXXXystemApi'
Time Elapsed: 00:00:16.0349189

Also, as in below screenshot, I see that there are few references which have a little warning signs which might be pointing towards what is wrong with my setup.

The type or namespace name 'Http' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

enter image description here

I tried to Add references to the project but I am not seeing any entry for System.Web.Http under add reference dialog.

How do I fix all this ?

like image 934
Naxi Avatar asked Sep 11 '25 09:09

Naxi


1 Answers

Try running

dotnet restore

in the Package Manager Console

Also, unloading and reloading the project has worked for me before (Right-click on the project name in the Solution explorer to unload and reload)

like image 168
BMiller Avatar answered Sep 13 '25 00:09

BMiller