0

I'm trying to run a web app, but I have problem with the API as Http and Mvc Does not Exist in the Namespace System.Web in Visual Studio 2019.

using System.Web.Http;
using System.Web.Mvc;

But as I've checked the references, they are already there as shown below:

enter image description here

I've tried deleting them from the packages folder and restore them again, restarting my computer and VS 2019 and lastly reinstalling VS 2019 but the issue still persists. Can someone help me with this? Thanks!

Xev
  • 109
  • 1
  • 1
  • 12
  • Is this an existing project or a new project? What version of ASP.NET are you meant to be targeting? You're certain this is for .NET Framework and not .NET Core? – Dai Dec 21 '20 at 06:24
  • This is an existing project. Yes, it's for .NET Framework. @Dai – Xev Dec 21 '20 at 08:15
  • What version of ASP.NET and what version of ASP.NET MVC and ASP.NET Web API? You shouldn't need to manage assembly references yourself, NuGet will do that for you - in fact, I'll bet the problem is you just need to do a NuGet Package Restore. – Dai Dec 21 '20 at 08:24

1 Answers1

1

If you want to get System.Web.Http, you need to install the package "Microsoft.AspNet.WebApi" from Nuget.

  1. Open Tools>NuGet Package Manager>NuGet Package Manager for Solution
  2. Click Browse tab and type "Microsoft.AspNet.WebApi"
  3. Choose the package and then check your project name at the right column
  4. Click Install
RezA
  • 103
  • 1
  • 8