8
votes

I am trying to use swagger for my web api documentation, For that i have installed Swashbuckle from nuget packages but i am unable to get the Bootstrapper package in the swaggerconfig.cs class. so is there any other alternative to get the Bootstrapper package in the swaggerconfig.cs class. Please help me out. Thank you.

5

5 Answers

4
votes

If your service is hosted in IIS, you can start exposing Swagger docs and a corresponding swagger-ui by simply installing the following Nuget package:

Install-Package Swashbuckle

This will add a reference to Swashbuckle.Core and also install a bootstrapper automatically

https://github.com/domaindrivendev/Swashbuckle

Thanks.

2
votes

If Swashbuckle.Bootstrapper.Init(config); is missing. I used an older version of Swashbuckle 4.1.0 it worked for me.

enter image description here

1
votes

I have published a tutorial and code here in case you want to have a look

1
votes

In my case I solved it by adding reference via WebApiConfig

public static class WebApiConfig
{

    public static void Register(HttpConfiguration config)
    {
        config.MapHttpAttributeRoutes();
        config.EnableSwagger(c =>
        {
            c.SingleApiVersion("v1", "WebAPI");
        }).EnableSwaggerUi();
    }
}
0
votes

It works with Swashbuckle >= 5.6.0

//namespace
using Swashbuckle.Application;

var config = new HttpConfiguration();
config.EnableSwagger(c => c.SingleApiVersion("v1", "A title for your API")).EnableSwaggerUi();