Note: This applies to .net 6 LTS
- Turn on XML Documentation generation in the project in Properties-Build-Output select Documentation File
- Modify the
AddSwaggerGen
line in theprogram.cs
file
builder.Services.AddSwaggerGen( c =>
c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory,
$"{Assembly.GetExecutingAssembly().GetName().Name}.xml")));
Note: This assumes that you are creating the xml documentation file in the default location and picking it up from there.