缺少程序集引用 - 但我相信该包已正确引用

Say*_*sei 4 c# asp.net-core asp.net-core-identity

当我注册以下using声明时:

using Microsoft.AspNetCore.Identity.UI;
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

命名空间“Microsoft.AspNetCore.Identity”中不存在“UI”类型或命名空间名称(缺少程序集引用?)

在我看来,一切都很顺利。我将 a 添加<PackageReference>NuGet 包Microsoft.AspNetCore.Identity.UI。但错误仍然存​​在。

我该如何解决这个问题?

我的.csproj

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.4" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.3" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.1.4" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SQLite" Version="3.1.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.3" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.3" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.1.1" />
  </ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)

和我的AssemblyInfo.cs

using System;
using System.Reflection;

[assembly: Microsoft.AspNetCore.Identity.UI.UIFrameworkAttribute("Bootstrap4")]
[assembly: System.Reflection.AssemblyCompanyAttribute("ESporcum")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("ESporcum")]
[assembly: System.Reflection.AssemblyTitleAttribute("ESporcum")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Run Code Online (Sandbox Code Playgroud)

小智 11

在 NuGet 包中

改变这个:

Microsoft.AspNetCore.Identity.UI Ver.5.0.1
Run Code Online (Sandbox Code Playgroud)

到:

Microsoft.AspNetCore.Identity.UI Ver.3.1.10
Run Code Online (Sandbox Code Playgroud)