20

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?

1
  • I've only been able to find the documentation on the format of the header and how to configure the elements within it, not the format of the comment itself.
    – ChrisF
    Mar 17, 2010 at 16:23

1 Answer 1

12

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

2
  • 2
    Thanks Leom, I think this will be the solution, it would be nice to extend or copy the code for rule SA1633 rather than re-writing it. Mar 18, 2010 at 11:08
  • 1
    Have anyone successfully written new rule for this already? Don't feel like recreating the wheel.
    – user275683
    Jul 1, 2014 at 15:38

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.