How to install Swashbuckle in .net core

  • Language:: CSharp

  • Type:: Back-end

  • Context:: Installs the Swashbuckle library for Swagger and OpenAPI on .net core

  • Description

  • Snippet

Install-Package Swashbuckle.AspNetCore -Version 6.5.0

In the ConfigureServices method of Startup.cs, register the Swagger generator, defining one or more Swagger documents.

using Microsoft.OpenApi.Models;
services.AddMvc();
 
services.AddSwaggerGen(c =>
{
   c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" });
});

Link:: Get started with Swashbuckle and ASP.NET Core | Microsoft Learn


📇Additional Metadata