【问题标题】:Missing assembly reference—but I believe the package is properly referenced缺少程序集引用——但我相信该包被正确引用
【发布时间】:2020-06-06 17:50:58
【问题描述】:

当我注册以下using 声明时:

using Microsoft.AspNetCore.Identity.UI;

我收到以下错误:

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

在我看来一切都是正确的。我包括<PackageReference>the Microsoft.AspNetCore.Identity.UI NuGet package。但错误仍然存​​在。

我该如何解决这个问题?

我的.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>

还有我的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")]

【问题讨论】:

  • 尝试删除您的 obj/ 文件夹并重新进行恢复
  • 由于你当前的项目是core 3.0版本,但是这些dll是3.1相关版本,请尝试更新版本一致再测试。

标签: c# asp.net-core asp.net-core-identity


【解决方案1】:

在 NuGet 包中

改变这个:

Microsoft.AspNetCore.Identity.UI Ver.5.0.1

到:

Microsoft.AspNetCore.Identity.UI Ver.3.1.10

【讨论】:

    猜你喜欢
    • 2019-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多