StyleCop 4.3 Is Released


The awaited StyleCop 4.3 update is now available. This update includes:



  • Various bugfixes, including fixes for VS integration issues

  • Rules documentation is included and integrated into VS “Show Error Help”

  • New rules (more detail below)

  • Branding change from Source Analysis to StyleCop

As promised, we will also be releasing SDK documentation for StyleCop explaining how to author custom rules and how to integrate the tool into custom build environments. The SDK documentation is currently under final review and we hope to release it very soon.


The new rules shipping with StyleCop 4.3 include:


·         Enforce sort order for using directives. This aligns with the Organize Usings functionality in VS 2008


·         Require standard summary text for constructors and destructors


·         Require parenthesis in arithmetic and comparison expressions for added clarity


·         Require String.Empty rather than “”


·         Require explanation message text in debug asserts


·         Require justification text in Code Analysis suppressions


·         Enforce use of built-in type aliases for int, string, float, etc.


·         Require a blank line between elements


·         Disallow blank lines at the top or bottom of documentation headers


·         Disallow regions within method bodies (enabled by default)


·         Disallow the use of regions anywhere within the code (disabled by default)


·         Disallow empty static constructors


·         Disallow empty unsafe, lock, checked, and unchecked statements


·         Disallow unnecessary or empty try\catch\finally


The 4.3 release is available here: https://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sourceanalysis&ReleaseId=1425


Comments (34)

  1. La nouvelle version de StyleCop, anciennement "Source Analysis" est disponible. En plus de nouvelles

  2. Toshi says:

    Thank you.

    Could you offer the means to internationalize the message in the next version?

  3. slawek says:

    Thanks.

    My wishlist for next releases:

    -Internationalize standard texts,

    -Auto-formatting file (eg removing unnecessary blank lines, adding brackets in if statements, etc.)

  4. Calvin says:

    Great, but i want to download the StyleCop 4.2, where could i find it please?

  5. Fabrizio says:

    Well Done.

    Someone could give me more detail about how work/how to setup Rules documentation integrated into VS "Show Error Help"

  6. The StyleCop team announced the release of a version 4.3 of the StyleCop tool . You can get it from here

  7. The StyleCop team announced the release of a version 4.3 of the StyleCop tool . You can get it from here

  8. A equiopa do StyleCop anunciou a saída da versão 4.3 da ferramenta StyleCop . Podem obtê-la aqui . Esta

  9. The guys from the code analysis team have just released new versions of their popular tools: StyleCop

  10. Gavin Greig says:

    I’m really pleased with StyleCop, and so glad that it’s been publicly released.

    I do have one suggestion for improvement though, with regard to SA1642, and any similar documentation rules.

    I’m using GhostDoc to help with writing doc comments, and it writes out type names as the "cref" attribute in a "see" tag, rather than as plain text. This has encouraged me to make more extensive use of the "see" tag in my own documentation. I value SA1642’s insistence on standard wording for documenting constructors, but I wish it would allow a properly specified "see" tag as a valid alternative to the type name in plain text.

  11. You’ve been kicked (a good thing) – Trackback from DotNetKicks.com

  12. Fabian says:

    Could you please add support for VB.NET. Thank you.

  13. StyleCop version 4.3 was released last tuesday. A short summary of what version 4.3 brings us: Various

  14. Guys, I found that Juan Pablo Garcia from Southworks has published the MVC 5 templates (among others) that are compliant with StyleCop, if you are running this tool you might find his post useful, as I did:    

    http://blogs.southworks.net/jpgarcia/2008/09/01/visual-studio-2008-templates-compliant-with-microsoft-stylecop/

  15. > Require String.Empty rather than “”

    Wow, now that’s a really lame rule. What next, Int32.Zero instead of 0?

  16. Как я уже писал в одном из своих предыдущих постов , стал доступен очередной релиз StyleCop. Обновление

  17. pierre says:

    "Wow, now that’s a really lame rule. What next, Int32.Zero instead of 0?"

    Not a lame rule at all. String.Empty does not, as opposed to "", initialize a new instance of String (it is a reference type). Int32.Zero is irrelevant in comparison, as it is a value type.

  18. Scott says:

    thank you so much for this!  I have over 1000 style errors in my code.  I thought I was pretty good at styling, but I guess not.

    Thanks.

  19. Scott says:

    So what is StyleCop going to do with all the generated code for XSD’s?  I have hundreds of errors for each XSD I use.  You going to work on fixing it?

  20. Jaret Russell says:

    Whenever I open a C# file in my project and run StyleCop (4.3), it crashes my Dev Studio. I’ve tried a couple of times with the same result. Is this a known issue? I’m running Visual Studio Team System 2008.

  21. While I was on holiday Microsoft released a new version of Microsoft Source Analysis for C# , in the

  22. hangy says:

    Jonathan, I think this is because of memory allocation. "" would always create a new immutable String object whereas String.Empty always is the same.

  23. B. Moeller says:

    Could you please add support for VB.NET. Thank you.

  24. Rik Hemsley says:

    Most of the warnings are about code generated by VS.NET – and they can’t be ignored. Marvellous. A feat of modern engineering.

  25. Biju Thomas says:

    we are eagerly waiting for the next version…………

  26. Biju Thomas says:

    How do we integrate style cop with web deployment project builds. We are developing user controls as separate web site and deploying it(as single assembly) using web deployment projects.

  27. josh says:

    thanks a lot…

    is there any version support for VB.NET and vs 2003 available?

  28. seashore says:

    An excellent tool, however, for a solution with 189 projects (.NET and Native) it makes Visual Studio so slow it’s painful to use. With a five second lag each time I clicked somewhere in Studio I briefly looked for a solution, gave up, and then uninstalled it: the only way I could figure out to turn it off.

    A pity, it seemed like a really nice extension.

  29. jasonall says:

    Hi Seashore. The performance issue you mentioned is tracked here: http://code.msdn.microsoft.com/sourceanalysis/WorkItem/View.aspx?WorkItemId=71

  30. jasonall says:

    Please use the StyleCop Discussion Forum for further comments as it provides a better mechanism for tracking topics and follow-ups.

  31. Agile/Software Development/ALT.NET The Art of Agile Development: Collective Code Ownership Raymond provides an entry into lean methodologies Jeffery was on the Software Quality Isn’t Optional panel and the video is available The StyleCop team announced

  32. Agile/Software Development/ALT.NET The Art of Agile Development: Collective Code Ownership Raymond provides an entry into lean methodologies Jeffery was on the Software Quality Isn’t Optional panel and the video is available The StyleCop team announced

  33. A equiopa do StyleCop anunciou a saída da versão 4.3 da ferramenta StyleCop . Podem obtê-la aqui . Esta