首页 > 解决方案 > ASP.NET 无法添加引用

问题描述

using System;
using Microsoft.AspNetCore.Identity;

namespace SC.BL.Domain
{
    // Add profile data for application users by adding properties to the WebApp1User class
    public class WebApp1User : IdentityUser
    {
        public string OwnerID { get; set; }
        [PersonalData]
        public string Name { get; set; }
        [PersonalData]
        public DateTime DOB { get; set; }
        public UserStatus UserStatus { get; set; }

    }

    public enum UserStatus
    {
        Submitted,
        Approved,
        Rejected
    }
}

在参考中找不到 AspNetCore: using Microsoft.AspNetCore.Identity See image for more details image

标签: asp.net-coreasp.net-core-mvcasp.net-identity

解决方案


将以下内容添加PackageReferenceYourProject.csproj文件并重建。问题应该会消失,因为这个元包包含 ASP.NET Core MVC、Entity Framework Core 和 ASP.NET Core Identity for ASP.NET Core Version <= 2.2的所有必要包

 <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App"/>
    .......
 </ItemGroup>

推荐阅读