首页 > 解决方案 > 构建错误 - 命名空间“Microsoft”中不存在类型或命名空间名称“AspNetCore”(您是否缺少程序集引用?

问题描述

我刚刚打开了一个前几天运行良好的项目。没有对代码进行任何更改,但是现在当我打开它时出现错误

命名空间“Microsoft”中不存在类型或命名空间名称“AspNetCore”(您是否缺少程序集引用?

唯一改变的是VS升级到16.5

我该如何解决?软件包都在那里,Nuget 报告一切都已安装。我已尝试卸载软件包并重新安装它们,但仍然出现错误。

这是我的 .csproj 文件

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Cors" Version="2.2.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.2" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.1" />
  </ItemGroup>


</Project>

标签: asp.net-coreasp.net-web-apinuget-package

解决方案


推荐阅读