Fixing Swashbuckle not generating swagger.json in ASP.NET Core

If you're encountering an issue with Swashbuckle not generating swagger.json in your ASP.NET Core application, there are a few things you can try to fix the problem.

First, ensure that you have the Swashbuckle.AspNetCore NuGet package installed and that it's the latest version. You can do this by checking your project's dependencies in Visual Studio or running the following command in the Package Manager Console:

Install-Package Swashbuckle.AspNetCore -Version {latest version number}

If you already have the latest version installed, try adding the following lines of code to your Startup.cs file:

app.UseSwaggerUI(c => {
    c.SwaggerEndpoint("/swagger/v1/swagger.json", "API V1");

This will enable Swagger middleware and configure the Swagger UI to display your API's documentation.

If these steps don't resolve the issue, try deleting your bin and obj folders and rebuilding the solution. This can sometimes clear up any caching issues that may be preventing Swashbuckle from generating the swagger.json file.

In summary, to fix Swashbuckle not generating swagger.json in ASP.NET Core, try ensuring the latest version of Swashbuckle.AspNetCore is installed, adding the necessary code to your Startup.cs file, and deleting and rebuilding your solution.

Click to rate this post!
[Total: 0 Average: 0]

Related posts

Leave a Reply

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

Go up

Below we inform you of the use we make of the data we collect while browsing our pages. You can change your preferences at any time by accessing the link to the Privacy Area that you will find at the bottom of our main page. More Information