The type or namespace name 'ApplicationUser' couldn't be found
I've included Identity into my .NET Core3.1 project, when I try to build the project, it warns me with the following error:
The type or namespace name 'ApplicationUser' couldn't be found (are you missing a using directive or an assembly reference?)
You'll have to create the ApplicationUser class yourself. The default user is IdentityUser. ApplicationUser inherits from IdentityUser:
public class ApplicationUser : IdentityUser
{
}
But if you are not extending ApplicationUser then you can also use IdentityUser. So instead of this:
services.AddIdentity<ApplicationUser, IdentityRole>()
you can use this:
services.AddIdentity<IdentityUser, IdentityRole>()
And replace ApplicationUser throughout the rest of the project with IdentityUser.
参考:
https://stackoverflow.com/questions/52015990/asp-net-core-2-1-identity-couldnt-find-applicationuser
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步