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

1

7

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

Archeozoic answered 21/10, 2021 at 12:58 Comment(0)
R
8

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

Retentive answered 5/2, 2022 at 20:14 Comment(1)
Indeed. I think he installed both Duende an IdentityServer4Cicada

© 2022 - 2024 — McMap. All rights reserved.