C
C#2y ago
Very Funny

✅ 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
Very Funny
Very FunnyOP2y ago
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<SupportedPlatform Include="browser"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<SupportedPlatform Include="browser"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
</ItemGroup>
</Project>
.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
Very Funny
Very FunnyOP2y ago
These seeem to be the only classes avaiable from the package when accessing it in my .Shared project
No description
viceroypenguin
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).
Very Funny
Very FunnyOP2y ago
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?
viceroypenguin
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
Very Funny
Very FunnyOP2y ago
Install that package instead of Microsoft.AspNetCore.Identity?
viceroypenguin
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
Very Funny
Very FunnyOP2y ago
Awesome, thanks

Did you find this page helpful?