'How to include XmlComments for Swagger in only one API Controller (not all Controllers in the same project)?

I'm trying to add more information about one of my API routes using Swashbuckle. I only need to enable XML comments files in Swagger for one of my API routes. But, checking 'XML documentation file:' in Project -> Properties would force me to put XML comments throughout the whole project. Is there a way to achieve this?

For this I've included XML comments, made sure build's Output has the 'XML documentation file:' checked, and have

var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
c.IncludeXmlComments(xmlPath);

in my SwaggerConfig.cs.



Solution 1:[1]

use [ApiExplorerSettings(IgnoreApi = true)] on all controllers you want to remove from documentation

Solution 2:[2]

At this point, any classes or methods that are NOT annotated with XML comments will trigger a build warning. To suppress this, enter the warning code "1591" into the "Suppress warnings" field in the properties dialog or add 1591 to the section of your .csproj project file.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Power Mouse
Solution 2 Niraj Trivedi