alexb
alexb

Reputation: 277

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...

Upvotes: 5

Views: 1620

Answers (2)

Venimir Petkov
Venimir Petkov

Reputation: 39

Install-Package Microsoft.Extensions.Identity.Store will resolve the problem.

Upvotes: 0

t2t
t2t

Reputation: 1251

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.

Upvotes: 3

Related Questions