Reputation: 121
Today, I upgraded my projects to netcoreapp 2.1 to 2.2. After that, my projects using Microsoft.AspNetCore.Identity give me an error: error CS0234: The name or namespace name 'Identity' does not exist in the 'Microsoft.AspNetCore' namespace (are you missing an assembly reference?)
If I add the Microsoft.AspNetCore.Identity nuget package in project reference, I don't have any error with using directive, but I have always error on cannot found IdentityUser I also cleaned nuget cache on my machine
My code is here: https://github.com/SOFTINUX/Base (If, you would try to reproduce, you need to restore npm packages in Barebone project before build)
So, in netcoreapp 2.2, Microsoft.AspNetCore.Identity is not found. With netcoreapp2.1, I have no problems.
I want to use Identity into my app with netcore2.2, but I not found any informations about changes on it and I tested with example app in netcoreapp2.2 and I have no problem with it. I supppose, the problem come from my project, but I dont see nothing
Thanks.
Upvotes: 2
Views: 597
Reputation: 23937
I've just cloned it and tried building it.
The error shows, that the namespace Microsoft.AspNetCore.Identity
is missing in the SoftinuxBase.Security.Data.Entities
project and that the compiler cannot find a reference for IdentityUser<T>
and IdentityRole<T>
both of which reside inside the Microsoft.AspNetCore.Identity.EntityFrameworkCore
package.
So to resolve your error add the this package to your entities project, either through project reference or package manager console:
install-package Microsoft.AspNetCore.Identity -ProjectName SoftinuxBase.Security.Data.Entities
install-package Microsoft.AspNetCore.Identity.EntityFrameworkCore -ProjectName SoftinuxBase.Security.Data.Entities
The EntityFrameworkCore package has a dependency on the base Identity package and should pull that in implicitly, I've just added in the install-package command for clarity. In theory you should get away with just pulling in The EF package.
After getting rid of all the other small issues like the missing Microsoft.AspNetCore.StaticFiles
package, I can compile the solution and get greeted by the following browser window:
So I suppose that this resolves your issue.
Upvotes: 1