• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

向的Swagger测试添加XML注释 网络核心


Recommended Posts

.Net Core Swagger测试加入XML注释

参考网站:向swagger添加文档注释的详细步骤(icode9.com)

没有添加XML注释效果:

bh45lehtcnf4219.png

2.编写代码并添加注释。

2-1.右键单击项目属性,生成以下内容,并检查xml文档以自动生成XML文档。

iwaiqpxqyp24220.png

2-2.右键单击该项目。生成之后,项目下还有一个额外的xml文件。右键单击属性中的xml文件,然后选择“始终复制”。

如果一直没有复制的点,将来发布到其他地方,xml文档可能就带不出来了。有鉴于此,swagger不会显示注释,或者在严重的情况下,页面打开时会出错,文件会丢失。

wfqecszefpz4221.png

2-3,在启动文件夹ConfigureServices方法中添加代码。

sh2cqf3dzi54222.png

//swagger加入XML提示开始

var baseDirectory=System。AppDomain . current domain . base directory;

var xmlFile=System。' AppDomain . current domain . friendly name '。XML ';

var xmlPath=Path。Combine(baseDirectory,XML file);

c.IncludeXmlComments(XML path);

//swagger加入XML提示结束。

2-4.向Swagger添加XML注释的效果

wcccuhy3b0c4223.png

Link to comment
Share on other sites