Swashbuckle.aspnetcore: Missing AddSwaggerGen

Created on 16 Jan 2020  Â·  2Comments  Â·  Source: domaindrivendev/Swashbuckle.AspNetCore

After creating a new API project in vs2019 with Core 3.1 and installing the Swashbuckle.AspNetCore.Swagger 5.0, adding the using, the moment is there....

Copy past the github Getting started code block....
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" });
});

The AddSwaggerGen is NOT there. However the app.UseSwagger() in the method Configure is there, and proofs Swagger is installed.

Swagger_error

Sorry guys, but I like to work with swagger, Hope you can solve it.

Most helpful comment

You’ve only installed one of the component packages (i.e. Swashbuckle.AspNetCore.Swagger). You need to install the main package “Swashbuckle.AspNetCore” as described in the readme

All 2 comments

You’ve only installed one of the component packages (i.e. Swashbuckle.AspNetCore.Swagger). You need to install the main package “Swashbuckle.AspNetCore” as described in the readme

You are completely right. That is a bold mistake. Thank you for the acuity, I missed that.

Was this page helpful?
0 / 5 - 0 ratings