Swashbuckle:
1. Program.cs
Services.AddSwaggerGen(c =>{ var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); c.IncludeXmlComments(xmlPath, includeControllerXmlComments: true);});
NSwag:
1.Edit <project_name>.csproj,加入以下項目
<PropertyGroup> <GenerateDocumentationFile>true</GenerateDocumentationFile> <NoWarn>$(NoWarn);1591</NoWarn></PropertyGroup>
2.Program.cs
Services.AddSwaggerDocument(config =>{ config.UseControllerSummaryAsTagDescription = true;});
沒有留言:
張貼留言