✅ Unable to use IdentityUser
I have installed Microsoft.AspNetCore.Identity into my project, but I am unable to access the class IdentityUser. Am I looking at the wrong package?
8 Replies
.csproj file
Weirdly enough, I had the same package in my .Server project and could access it. However even after uninstalling it from there I could still access it
These seeem to be the only classes avaiable from the package when accessing it in my .Shared project
Have you tried following the instructions here? https://learn.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-7.0&tabs=visual-studio?
Introduction to Identity on ASP.NET Core
Use Identity with an ASP.NET Core app. Learn how to set password requirements (RequireDigit, RequiredLength, RequiredUniqueChars, and more).
oh, hmmm. Is there an inherit problem for me trying to use this in a .Shared project that doesn't have a Program.cs file?
specifically, the package you'll use will be Microsoft.AspNetCore.Identity.UI.
The version number (2.2.0) and the fact that it is deprecated on nuget indicate that the package Microsoft.AspNetCore.Identity is the incorrect package, used back in netcore 2.2
If you're doing stuff in a .Shared project, you can use the Microsoft.Extensions.Identity.Stores project
Install that package instead of Microsoft.AspNetCore.Identity?
correct
Microsoft.AspNetCore.Identity is outdated and only exists for backcompat for older systems that haven't updated. it is not compatible with modern versions of .net
Awesome, thanks