【发布时间】:2021-08-16 00:33:39
【问题描述】:
【问题讨论】:
-
我尝试将 XML 文件添加到 wwwroot 文件夹中,但它也不起作用......有人像我一样遇到这种情况......
标签: asp.net-core-webapi swagger-ui .net-5 webapi xml-comments
【问题讨论】:
标签: asp.net-core-webapi swagger-ui .net-5 webapi xml-comments
XML cmets 可以通过以下方法启用:
在解决方案资源管理器中右键单击项目并选择编辑
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>
public void ConfigureServices(IServiceCollection services)
{
.......//swagger config..
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
c.IncludeXmlComments(xmlPath);
【讨论】: