ASP.NET Core Swagger 显示接口注释
在Startup中
services.AddSwaggerGen(options => { options.SwaggerDoc("v1", new Info { Title = "IMS API", Version = "v1" }); options.SwaggerDoc("v2", new Info { Title = "IMS API V2", Version = "v2" }); //添加中文注释 var basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location); var commentsFileName = typeof(JcbApplicationModule).Assembly.GetName().Name + ".XML"; var xmlPath = Path.Combine(basePath, commentsFileName); options.IncludeXmlComments(xmlPath); options.DocInclusionPredicate((docName, description) => true);
然后在Application这个层 属性-生成-生成XML文档文件