找不到XML注释文件-Swagger [英] XML comments file could not be found - Swagger

查看:849
本文介绍了找不到XML注释文件-Swagger的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这肯定是让您发疯的那些人之一.正如标题所示,我只是想做的就是显示使用swagger从xml文件中提取的注释.

This is certainly one of those that drives you nuts. As the title indicates all I'm simply trying to do is display comments pulled from an xml file using swagger.

我似乎已经按照招摇的文档采取了所有步骤,但无济于事.希望您友善的人能指出我正确的方向.

I appear to have taken all steps according to the swagger documentation but to no avail. Hopefully you kind folk can point me in the right direction.

已采取的步骤:

确保的文件存在:

已配置SwaggerConfig.cs

我也尝试过更改路径:@"bin/.... xml"

I've tried changing the path too: @"bin/....xml"

似乎没有任何作用.

**错误找不到文件":**

**The Error "Could not find file": **

有人可以指出我的正确方向吗?

Can anyone point me in the right direction please?

此致

推荐答案

好,所以我设法通过指向根目录来使其工作.

Ok, So I managed to get it to work by pointing to the root directory.

我仍然不知道为什么它无法检测到bin目录中的xml文件. 再次通过在根目录内添加xml文件来工作.

I still have no idea why it cannot detect the xml file in the bin directory. Again this worked by adding an xml file within the root.

代码更改:

var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
                        //var commentsFileName = Assembly.GetExecutingAssembly().GetName().Name + ".XML";
                        var commentsFileName = "Comments" + ".XML";
                        var commentsFile = Path.Combine(baseDirectory, commentsFileName);

                        c.IncludeXmlComments(commentsFile);

这篇关于找不到XML注释文件-Swagger的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆