asp.net-core

Issues after migration of Asp.Net Core RC1 to RC2


We have migrated our project from Asp.Net core RC1 to RC2. We are getting 2 compilation errors in the following places after the migrations.

First Issue is in the startup.cs:

The call is ambiguous between the following methods or properties:

public void ConfigureServices(IServiceCollection services)
{

...

services.AddIdentity<ApplicationUser, IdentityRole>()
       .AddEntityFrameworkStores<ApplicationDbContext>()
       .AddDefaultTokenProviders();
       
       
       ...
}

Error Details:

Error CS0121 The call is ambiguous between the following methods or properties: 'Microsoft.Extensions.DependencyInjection.IdentityServiceCollectionExtensions.AddIdentity<TUser, TRole>(Microsoft.Extensions.DependencyInjection.IServiceCollection)' and 'Microsoft.Extensions.DependencyInjection.IdentityServiceCollectionExtensions.AddIdentity<TUser, TRole>(Microsoft.Extensions.DependencyInjection.IServiceCollection)' Firebolt.SecurityService..NETCoreApp,Version=v1.0 C:\Krishnan\RSI\SourceCode\Bluesky Developement\BlueSky Development\Firebolt.Security\src\Firebolt.Security\Startup.cs 58 Active

Second Issue:

[Microsoft.Data.Entity.Infrastructure.DbContext(typeof(ApplicationDbContext))]
    [Migration("00000000000000_CreateIdentitySchema")]
    partial class CreateIdentitySchema
    {
        protected override void BuildTargetModel(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder)
        {
     ...
}

Error Details:

Error CS0115 'CreateIdentitySchema.BuildTargetModel(ModelBuilder)': no suitable method found to override Firebolt.SecurityService..NETCoreApp,Version=v1.0 C:\Krishnan\RSI\SourceCode\Bluesky Developement\BlueSky Development\Firebolt.Security\src\Firebolt.Security\Migrations\00000000000000_CreateIdentitySchema.Designer.cs 15 Active

What is the fix for these 2 issues?


Solution

  • I have found the solutions for both of the issues. I am posting it here which might be useful to others

    First Issue

    Error CS0121 The call is ambiguous between the following methods or properties: 'Microsoft.Extensions.DependencyInjection.IdentityServiceCollectionExtensions.AddIdentity<TUser, TRole>(Microsoft.Extensions.DependencyInjection.IServiceCollection)' and 'Microsoft.Extensions.DependencyInjection.IdentityServiceCollectionExtensions.AddIdentity<TUser, TRole>(Microsoft.Extensions.DependencyInjection.IServiceCollection)' Firebolt.SecurityService..NETCoreApp,Version=v1.0

    the Issue was with the following 2 config entries in Project.json. I replaced the existing entries with the following 2 and it solved the issues

     "Microsoft.AspNetCore.Identity": "1.0.0-rc2-final",
     "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0-rc2-final",
    

    Error CS0115 'CreateIdentitySchema.BuildTargetModel(ModelBuilder)': no suitable method found to override Firebolt.SecurityService..NETCoreApp,Version=v1.0

    Find/Replace the existing using namespaces in all the migrations related classes

    using Microsoft.Data.Entity with using Microsoft.EntityFrameworkCore