将 UrlHelper 从 ASP MVC 4 迁移到 ASP MVC 5

Migrate UrlHelper from ASP MVC 4 to ASP MVC 5

我有解决方案结构

MyProject.BusinessLayer 引用了来自 (ASP MVC 4) 的 System.Web.Http.Routing.UrlHelper:

C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies\System.Web.Http.dll

我想删除该依赖项并从现有 MVC 5 版本中使用。

我有一些问题?

我在本地安装了 ASP MVC 4,但在 Azure DevOps 中构建过程失败:

The type or namespace name 'UrlHelper' could not be found (are you missing a using directive or an assembly reference?)

正在安装 Microsoft.AspNet.WebApi.Core 2.3.3 修复了问题