Setting up the Swagger documentation
To install Swagger, open your solution and from the menu, select Tools | NuGet Package Manager | Manage NuGet Packages for Solution. Install the latest version of Swashbuckle.AspNetCore
.
Right-click on your project file and click on Properties. On the left of your screen, choose Application. On the right, choose Console Application, as shown in Figure 4.1:
Figure 4.1 – Installation part 1
Under Build, choose Output and scroll down to Documentation file. Check the Generate a file containing API documentation box, as shown in Figure 4.2:
Figure 4.2 – Setting up Swagger output
Note
In Figure 4.2, Generate a file containing API documentation is checked. The file that is generated can be imported into other applications, such as Postman, for an integrated documentation and testing experience.
Open Program.cs
(typically the last file in Solution Explorer) and add the Swagger...