All I\'m trying to do is add swagger to an ASP.Net Core application. I\'m watching a tutorial and all I see them do is add services.AddSwaggerGen(); under the c
This happens because the implementation of AddSwaggerGen() extension method in ASP.NET Core requires you to provide Action argument which serves as setup action. For example:
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" });
});
You can learn more on how to setup Swagger with ASP.NET Core app here.
UPDATE:
In previous versions they had the AddSwaggerGen() extension method accepting no arguments, but this call was accompanied with call ConfigureSwaggerDocument(Action. I guess they just got rid of ConfigureSwaggerDocument and added setup action to AddSwaggerGen() method. That being said it seems your tutorial shows how to setup obsolete version of the Swagger.