我得到这个警告:“缺少公开可见类型或成员的XML注释”。
如何解决这个问题?
我得到这个警告:“缺少公开可见类型或成员的XML注释”。
如何解决这个问题?
当前回答
#pragma warning disable 1591
#pragma warning disable 1591
#pragma warning disable 1572
#pragma warning disable 1571
#pragma warning disable 1573
#pragma warning disable 1587
#pragma warning disable 1570
其他回答
I know this is a really old thread, but it's the first response on google so I thought I'd add this bit of information: This behavior only occurs when the warning level is set to 4 under "Project Properties" -> "Build". Unless you really need that much information you can set it to 3 and you'll get rid of these warnings. Of course, changing the warning level affects more than just comments, so please refer to the documentation if you're unsure what you'll be missing: https://msdn.microsoft.com/en-us/library/thxezb7y.aspx
这是因为您的项目属性中指定了一个XML文档文件,而您的方法/类是公共的,缺乏文档。 你可以:
禁用XML文档: 右键单击您的项目->属性->“构建”选项卡->取消选中XML文档文件。 坐下来自己写文档吧!
XML文档的总结如下:
/// <summary>
/// Description of the class/method/variable
/// </summary>
..declaration goes here..
将警告级别设置为2将抑制此消息。不知道这是否是最好的解决方案,因为它也抑制了有用的警告。
在将一个属性附加到一个方法后,我得到了这条消息
[webMethod]
public void DoSomething()
{
}
但正确的做法是:
[webMethod()] // Note the Parentheses
public void DoSomething()
{
}
5个选项:
Fill in the documentation comments (great, but time-consuming) Turn off the comment generation (in project properties) Disable the warning in project properties (in 'Project properties' go to Project properties -> Build > "Errors and warnings" (section), Suppress Warnings (textbox), add 1591 (comma separated list)). By default it will change Active Configuration, consider to change configuration to All. Use #pragma warning disable 1591 to disable the warning just for some bits of code (and #pragma warning restore 1591 afterwards) Ignore the warnings (bad idea - you'll miss new "real" warnings)