I've created one API project with asp.net core in which I used swashbuckle.AspNetCore.dll to generate swagger.

It is working perfectly and going well.

Now I have another C#(.NET Standard library) in which I have created some GET, POST, DELETE, PUT method.

Need to load all of those methods to the swagger API project.

I've tried to use that separate C# library(.dll) to my project, but it didn't load to swagger.

Added this line to configuration service method at Startup.cs file:

services.AddSwaggerGen(c => {
    c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" });
    c.AddSecurityDefinition("Bearer", new ApiKeyScheme {
                In = "header", Description = "Please enter JWT with Bearer into field",
                Name = "Authorization", Type = "apiKey"
    c.AddSecurityRequirement(new Dictionary<string, IEnumerable<string>> {
        { "Bearer", Enumerable.Empty<string>() },

Added this line to Configure method at startup.cs file:


// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), 
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>
    c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
    c.RoutePrefix = string.Empty;

It shows swagger with swagger project method. It should show both methods whether it is in a separate library or swagger project itself.

1 Answers

sk5202 On Best Solutions

I used service stack swagger instead of swashbuckle.

It's solve my problem.

here is the solution.