Monday, June 13, 2016

Adding Swashbuckle to your ASP.NET Web API Web project

If you want to use Swashbuckle/Swagger to document your ASP.NET Web API application as an alternative to ASP.NET Web API Help, then you can follow these simple steps below:


  1. Add a NuGet package reference for Swashbuckle to your ASP.NET Web API project
  2. Click OK to accept the installation of the NuGet package
  3. You will now see a SwaggerConfig.cs file in your App_Start directory
  4. You have to enable Xml documentation in the Build properties for your Visual Studio project
  5. In order to display Xml Comments for your Swagger documentation, you have to uncomment the line for c.IncludeXmlComments(GetXmlCommentsPath());
  6. Now when you navigate to the /Swagger Url in your ASP.NET Web API application, you should be able to view the Swagger documentation!






No comments:

Post a Comment