how to debug in stylecop in vs2008? RRS feed

  • Question

    how to debug in stylecop in vs2008?

    Dom Carlos - Impact Kung Fu Cascavel
    Thursday, October 16, 2008 11:10 AM


All replies

  • Hello Dom Carlos,

    Do you mean debugging custom StyleCop rules in Visual Studio 2008?

    if that the case, please refer to the link below on how to debug FxCop custom rules:

    please try to follow the steps and let me know if it works?


    • Edited by liurong luo Wednesday, October 22, 2008 9:03 AM some details
    Wednesday, October 22, 2008 9:01 AM
  •  The Visual Studio Code Analysis team does not own StyleCop, I think you want to try this forum instead: http://code.msdn.microsoft.com/sourceanalysis/Thread/List.aspx

    VS Code Analysis Team
    • Marked as answer by liurong luo Thursday, November 13, 2008 8:24 AM
    Thursday, October 23, 2008 5:29 PM
  • One way:

    1) Delete your custom rules
    2) Open Visual Studio (for dev), open your custom rule solution
    3) Build & Deploy custom rules (a PostBuild action to copy the rules into the StyleCop folder is handy)
    4) Open Visual Studio (for test)
    5) Use VS (dev) and Attach to process devenv.exe (the test VS instance), set breakpoints in the rules you want to debug
    6) Use VS (test) and right-click on project, Run StyleCop
    7) Debug

    Another way:



    I am also playing with stylecop customized rules.

    Couldn't quite get the second one work. Good luck.


    Thursday, April 22, 2010 8:56 AM
  • BTW, in the first method.

    1) In pre-build, copy the *.xml file into your stylecop installation folder, e.g.:

    xcopy "C:\workdir\MyCodeReviewer\MyCodeReviewer\bin\Debug\MyCodeAnalyzer.xml" "C:\Program Files\Microsoft StyleCop" /r /i /y

    2) In post-build, copy your *.dll and *.pdb to the stylecop installation folder, e.g.:

    xcopy "C:\workdir\MyCodeReviewer\MyCodeReviewer\bin\Debug\InfraCsAnalyzer.*" "C:\Program Files\Microsoft StyleCop" /r /i /y

    To make the above work, make sure you opened your visual studio with "Run as Administrator".

    Thursday, April 22, 2010 10:15 AM
  • .Tintin,

    I tried these steps, but debugging not fires. I am using Vs.NET 2010. Any help would be appreciated.

    And also tried the way as it is explained in the provided Url, but no luck. Please shed some light :)

    Am i missing any there?
    Monday, December 20, 2010 10:15 AM