.NET5 WebAPI 自带Swagger 显示注释
笔记
第一步:选择项目--》右键--》属性,如下所示:
第二步:修改Startup中ConfigureServices,如下所示:
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);