Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- services.AddSwaggerGen(c =>
- {
- //The generated Swagger JSON file will have these properties.
- c.SwaggerDoc("v1", new Info
- {
- Title = "Swagger XML Api",
- Version = "v1",
- });
- //Locate the XML file being generated by ASP.NET...
- var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
- var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
- //... and tell Swagger to use those XML comments.
- c.IncludeXmlComments(xmlPath);
- });
- }
- app.UseSwagger();
- app.UseSwaggerUI(c =>
- {
- c.SwaggerEndpoint("/swagger/v1/swagger.json", "Swagger XML Api v1");
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement