C# 找不到类型命名空间名称IdentityUser
在我所包含的最后两个框架中,我一直遇到这个错误。我上下搜寻过。我想不出是什么。我已经安装了NuGet软件包并多次尝试重新编译。什么都没用。这是我的密码C# 找不到类型命名空间名称IdentityUser,c#,asp.net-mvc,asp.net-mvc-5,C#,Asp.net Mvc,Asp.net Mvc 5,在我所包含的最后两个框架中,我一直遇到这个错误。我上下搜寻过。我想不出是什么。我已经安装了NuGet软件包并多次尝试重新编译。什么都没用。这是我的密码 using System; using System.Collections.Generic; using System.Linq; using System.Web; using IdentityUser; using IdentityDbContext; namespace UserProfileInfo.Models { publ
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using IdentityUser;
using IdentityDbContext;
namespace UserProfileInfo.Models
{
public class UserProfile : IdentityUser
{
public virtual UserProfile UserInfo { get; set; }
}
public class UserProfileDB
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
public class MyDbContext : IdentityDbContext<UserProfile>
{
public MyDbContext()
: base("DefaultConnection")
{
}
public System.Data.Entity.DbSet<UserProfile> UserInfo { get; set; }
}
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用System.Web;
使用IdentityUser;
使用IdentityDbContext;
命名空间UserProfileInfo.Models
{
公共类用户配置文件:IdentityUser
{
公共虚拟用户配置文件UserInfo{get;set;}
}
公共类UserProfileDB
{
公共int Id{get;set;}
公共字符串名{get;set;}
公共字符串LastName{get;set;}
}
公共类MyDbContext:IdentityDbContext
{
公共MyDbContext()
:base(“默认连接”)
{
}
public System.Data.Entity.DbSet UserInfo{get;set;}
}
}
不需要-
using IdentityUser;
using IdentityDbContext;
相反,您需要添加以下内容-
using Microsoft.AspNet.Identity.EntityFramework;
确保将该DLL作为参考,如下所示。如果它不可用,那么您可以从中获取nuget
对于AspNet Core 1,请使用NuGet: Microsoft.AspNetCore.Identity.EntityFrameworkCore 对于AspNet Core 2,请使用NuGet: Microsoft.AspNetCore.Identity
这是针对Dotnet Core的,您不会收到任何警告
使用Microsoft.Extensions.Identity.Stores
@堆栈流可以使用Microsoft.AspNet.Identity.EntityFramework添加-
代码>并让我知道发生了什么?另外,在参考资料中,您可以看到是否添加了DLL us?实际上,它使用的是Microsoft.AspNetCore.Identity代码>荣誉