Swagger 文本文档注释展示 Demo
作者:互联网
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "SwaggerDemo", Version = "v1" });
#region 为Swagger JSON and UI设置xml文档注释路径
string basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location);//获取应用程序所在目录(绝对,不受工作目录影响,建议采用此方法获取路径)
string xmlPath = Path.Combine(basePath, "SwaggerDemo.xml");
c.IncludeXmlComments(xmlPath);
#endregion
});
标签:xml,文本文档,string,Demo,xmlPath,SwaggerDemo,Path,Swagger 来源: https://www.cnblogs.com/YZM97/p/15782538.html