c# – Visual Studio raises an error adding endpoints with the wizard


Using Visual Studio 2022, I want to generate the API using the wizard for endpoints. The first endpoint is fine. When I create the second one, I get this error.

error CS0121: The call is ambiguous between the following methods or properties: ‘HypnoPlatform.Controllers.ClientEndpoints.MapClientEndpoints(Microsoft.AspNetCore.Routing.IEndpointRouteBuilder)’ and ‘HypnoPlatform.Controllers.ClientEndpoints.MapClientEndpoints(Microsoft.AspNetCore.Routing.IEndpointRouteBuilder)’

enter image description here

In order to compile the solution and generate a new endpoint, I have to comment in the Program.cs the reference to this endpoint like

// app.MapClientEndpoints();

and then I can continue. When I run the application, sometimes I get the same error but with all the endpoints.

Leave a Reply

Your email address will not be published. Required fields are marked *