找不到类型或命名空间名称 'ApiController' - 已安装 Nuget

The type or namespace name 'ApiController' could not be found - Nuget is installed

框架:.Net Framework 4.7.2.

Web api 项目: 从 git 提取代码(在不同的本地机器上工作和编译)并尝试构建后, 得到:

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

关于所有 apiController 继承的 class 属性和关键字:ApiController、HttpPost、FromBody 等),

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Web.Http;

namespace POC_Book_Api.Controllers
{
    public class MyController : ApiController
    {
        
        [HttpPost]
        public void Post([FromBody] SomeCollection items)

System.Web 项目引用中引用了程序集。 Nuget Microsoft.AspNet.Api 已在项目中安装和更新。

我在这里错过了什么?

请尝试通过包管理控制台重新安装包:

Install-Package Microsoft.AspNet.WebApi

请确保您选择了正确的项目并且包源是 nuget.org:

解决方法是重新安装(卸载+安装)相关包。问题是,在通过 Nuget 包管理器卸载它时 - 它实际上并没有卸载它,因为其他 nuget 包依赖于它。 只有在使用包管理器控制台完成后我才意识到这一点。 我卸载了所有依赖项 - 然后是 nuget 本身,然后再次安装它