本文介绍了StyleCop XML文档标题 - 使用3 ///而不是2 //的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的c#文件中使用XML文档标头来传递StyleCop规则SA1633。



目前,我必须使用2斜线注释规则来允许StyleCop识别标题。例如:

  //< copyright file =abc.ascx.cscompany =MyCompany.com> 
// MyCompany.com。版权所有。
//< / copyright>
//< author> Me< / author>

这适用于StyleCop,但是我想使用3斜线注释规则启用visual studio将注释理解为XML并提供XML功能(突出显示,自动缩进等)

  ///< copyright file = abc.ascx.cscompany =MyCompany.com> 
/// MyCompany.com。版权所有。
///< / copyright>
///< author> Me< / author>问题是,当使用3个斜杠时,StyleCop不再看到头部并抛出SA1633警告。



还有没有配置stylecop来理解头文件包含在XML中使用3斜杠?





Adam

解决方案

您可以建立自订规则,原创,赞成你的新:


I am using XML documentation headers on my c# files to pass the StyleCop rule SA1633.

Currently, I have to use the 2 slash commenting rule to allow StyleCop to recognize the header. for example:

// <copyright file="abc.ascx.cs" company="MyCompany.com">
//     MyCompany.com. All rights reserved.
// </copyright>
// <author>Me</author>

This works fine for StyleCop, however I would like to use the 3 slash commenting rule to enable visual studio to understand the comments as XML and provide the XML functionality (highlighting, auto indenting etc)

/// <copyright file="abc.ascx.cs" company="MyCompany.com">
///     MyCompany.com. All rights reserved.
/// </copyright>
/// <author>Me</author>

The problem is that when using 3 slashes, StyleCop no longer see's the header and throws the SA1633 warning.

Is there anyway to configure stylecop to understand the header is contained in XML using 3 slashes?

Thanks,

Adam

解决方案

You could build a custom rule and disable the original in favour of your new one:http://scottwhite.blogspot.com/2008/11/creating-custom-stylecop-rules-in-c.html

这篇关于StyleCop XML文档标题 - 使用3 ///而不是2 //的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 04:09