This is certainly one of those that drives you nuts. As the title indicates all I\'m simply trying to do is display comments pulled from an xml file using swagger.
I
These are the steps I needed in .Net Core 2.2:
Put this in Startup.cs:
public void ConfigureServices(IServiceCollection services)
{
...
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(c =>
{
...
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
c.IncludeXmlComments(xmlPath);
});
}
Edit your .csproj file and add / change these nodes:
<PropertyGroup>
...
<!--
Make sure documentation XML is also included when publishing (not only when testing)
see https://github.com/Azure/service-fabric-issues/issues/190
-->
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
...
<DocumentationFile>bin\$(Configuration)\YOUR_PROJECT_NAME.xml</DocumentationFile>
</PropertyGroup>
May be I am little late but would like to share my fixes, I opened the .csproj file in Notepad++ and removed all the comments (), saved the file and opened the solution again, a (if your solution has more then one projects, do with all .csproj files)