Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type 'IdentityRole' is defined in an assembly that is not referenced

I'm getting the following error when I attempt to inherit my dbcontext in an asp.net core 2.0 library from IdentityDbContext:

Error CS0012 The type 'IdentityRole' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.Extensions.Identity.Stores, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.

When I attempt to install the pkg I get:

Unable to find version '2.0.0' of package 'Microsoft.Extensions.Identity.Stores'. At line:1 char:1 + Install-Package Microsoft.Extensions.Identity.Stores -Version 2.0.0 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

I've been going round and round with this for two days. Hopefully a solution will come soon...

like image 204
alexb Avatar asked Oct 17 '22 05:10

alexb


1 Answers

Because I had the same problem: Add the nuget package via Package Manager Console to your project.

Install-Package Microsoft.Extensions.Identity.Stores -Version 2.0.2

And choose the correct nuget package version.

like image 195
t2t Avatar answered Oct 21 '22 06:10

t2t