This is because the implementation of AddSwaggerGen() extension in ASP.NET Core requires the provision of the Action<SwaggerGenOptions> which serves as the installation action. For instance:
services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" }); });
You can learn more about how to configure Swagger with the ASP.NET Core application here .
UPDATE: In previous versions, they had an AddSwaggerGen() extension method accepting arguments, but this call was followed by a call to ConfigureSwaggerDocument(Action<SwaggerGenOptions> setupAction) . I guess they just got rid of ConfigureSwaggerDocument and added the installation action to AddSwaggerGen() . At the same time, it seems that your lesson shows how to install an outdated version of Swagger.
source share