在启动模块中找到配置Swagger的方法,在Options中添加xml文档的地址,xml需要在生成的时候勾选输出xml
var basepath = PlatformServices.Default.Application.ApplicationBasePath; var xmlPath = Path.Combine(basepath, "xx.xx.Application.Contracts.xml"); options.IncludeXmlComments(xmlPath, false); xmlPath = Path.Combine(basepath, "xx.xx.Application.xml"); options.IncludeXmlComments(xmlPath, false);
可以添加多个xml文档