AddIdentityServer() This call is ambiguous between the following methods or properties

Viewed 741

My project is working fine and building fine as well. However, when I add package rsk.identityserver4.saml it gives me error on this code.

 var builder = services.AddIdentityServer(options =>
            {
                options.Events.RaiseErrorEvents = true;
                options.Events.RaiseInformationEvents = true;
                options.Events.RaiseFailureEvents = true;
                options.Events.RaiseSuccessEvents = true;

                // see https://identityserver4.readthedocs.io/en/latest/topics/resources.html
                options.EmitStaticAudienceClaim = true;
            })

and the error is

Severity    Code    Description Project File    Line    Suppression State
Error   CS0121  The call is ambiguous between the following methods or properties: 'Microsoft.Extensions.DependencyInjection.IdentityServerServiceCollectionExtensions.AddIdentityServer(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Action<IdentityServer4.Configuration.IdentityServerOptions>)' and 'Microsoft.Extensions.DependencyInjection.IdentityServerServiceCollectionExtensions.AddIdentityServer(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Action<Duende.IdentityServer.Configuration.IdentityServerOptions>)'    IdentityServer  D:\Office\GitHub\NLP\identityserver\IdentityServer\Startup.cs   58  Active

If I remove this package then it works fine again. How to overcome this issue ?

Error

1 Answers

Maybe you have IdentityServer4 and Microsoft.AspNetCore.ApiAuthorization.IdentityServer installed. You must delete one and bye error

Related