'The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' .NET MVC 5 to .NET Core 3.1 MVC Migration

I have almost completed my migration from ASP.NET MVC 5 to .NET Core 3.1 and I am getting this error,

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

The error is occurring in my /Views/Shared/Error.cshtml view, where I am setting the model.

@model System.Web.Mvc.HandleErrorInfo

@{
    ViewBag.Title = "Error"
}

<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>

I have removed all of the AspNetCore packages and re-added them, and I have tried restarting my Visual Studio (VS19), all to no avail.

Perhaps the error handling has been moved out of the MVC package in .NET Core? That’s my best guess.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source