locked
Reference to type IdentityBuilder claims it is defined in microsoft.aspnetcore.identity but it could not be found RRS feed

  • Question

  • User1428199325 posted

    I'm getting this error when upgraded csproj to netstandard1.2 then come NuGet package upgrade in csproj.  This csproj is a dependency DLL to the 3 WebApp csproj.

    Error --> Reference to type IdentityBuilder claims it is defined in microsoft.aspnetcore.identity but it could not be found

    I'm a bit stump & not having much luck after 2 days of Google search but found this one link at https://forums.asp.net/t/2162412.aspx?Error+with+aspnetcore+3+1+identity+

    public static void AddPaymentsForPortal<TRequestContext, TUserContext>(this IServiceCollection services, IConfiguration configuration, IEnumerable<EmbeddedAssemblySource> embeddedViewAssemblies, PortalRoleType roleType)

    {

         services.AddIdentity<ApplicationUser, IdentityRole<Guid>>()

        .AddEntityFrameworkStores<ApplicationContext, Guid>()

        .AddDefaultTokenProviders();

    }

    public class ApplicationContext : IdentityDbContext<ApplicationUser, IdentityRole<Guid>, Guid>

    {

        public ApplicationContext(DbContextOptions<ApplicationContext> options) : base(options)

        {

        }

     protected override void OnModelCreating(ModelBuilder builder)

    {

    }

    public class ApplicationUser : IdentityUser<Guid>, IUser

    {

        public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)

        {

        }

    }

    <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />

    <PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="3.1.3" />

    <PackageReference Include="Microsoft.AspNetCore.DataProtection.AzureStorage" Version="1.0.2" />

    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.2" />

    <PackageReference Include="Microsoft.AspNetCore.HttpOverrides" Version="1.1.2" />

    <PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />

    <PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Xml" Version="1.1.3" />

    <PackageReference Include="Microsoft.AspNetCore.Session" Version="1.1.2" />

    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />

    <PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="1.1.2" />

    <PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="1.1.2" />

    <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.3" />

    <PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="3.1.3" />

    <PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="1.1.1" />

    <PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.3" />

    Thursday, April 30, 2020 4:52 PM

All replies

  • User711641945 posted

    Hi fletchsod2,

    Your code is not clear and i could not reproduce your issue by your code.Here are some doubts I have:

    1.Where did you define and use AddPaymentsForPortal method?

    2.What is your ApplicationUser.GenerateUserIdentityAsync() used to do?

    3.Which line makes such error?

    Best Regards,

    Rena

    Friday, May 1, 2020 5:51 AM