Skip to content

Commit b0bbd40

Browse files
committed
add docs
1 parent 5ea5c57 commit b0bbd40

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,24 @@ app.UseEndpoints(endpoints =>
7373
});
7474
```
7575

76+
5.更多功能
77+
78+
为文档添加注释 在项目上右键--属性--生成
79+
80+
![](https://pic.downk.cc/item/5f34161d14195aa59413f0fc.jpg)
81+
82+
在AddSwaggerGen方法中添加如下代码
83+
84+
```
85+
c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "SwaggerDemo.xml"),true);
86+
```
87+
最后一个参数设置为true,代表启用控制器上的注释
88+
89+
运行后如看不到控制器上注释显示,请点开文档管理->个性化设置,开启分组tag显示description说明属性
90+
91+
![](https://pic.downk.cc/item/5f34171114195aa594142d2e.jpg)
92+
93+
7694

7795
### 🔎 效果图
7896
运行项目,打开 https://localhost:5001/index.html#/home

0 commit comments

Comments
 (0)