How to integrate FxCop and VS 2008?

前端 未结 3 1169
情深已故
情深已故 2021-01-31 00:05

If this is duplicated question, please point me to the proper link and I\'ll delete this question.

I know that in VS Team System I can use Code Analysis but I\'m using V

相关标签:
3条回答
  • 2021-01-31 00:49

    How about setting up FxCop as an external tool in Visual Studio? Here's the link:

    http://msdn.microsoft.com/en-us/library/bb429389(VS.80).aspx

    0 讨论(0)
  • 2021-01-31 00:58

    I run a command very similar Vadim's as a Post-Build event for the project. That way, I get the FxCop errors as soon as I recompile. But our commands are pretty much the same; nice to know at least two people in the world reached the same conclusion!

    The errors do show up in Visual Studo's Error List pane.

    "%ProgramFiles%\Microsoft FxCop 1.36\FxCopCmd.exe"
    /file:"$(TargetPath)" 
    /console
    /dictionary:"$(SolutionDir)Res\FxCop\CustomDictionary.xml"
    /searchgac 
    /ignoregeneratedcode
    

    (You can omit the /dictionary argument; it just points to one of my custom dictionary files since FxCop flags a few variable names as Hungarian notation when they aren't. I also line-wrapped the command for readability.)

    It does make the build a little longer, but it's nice to see the errors right away and to tailor the command settings per project. Good luck!

    0 讨论(0)
  • 2021-01-31 01:05

    It took awhile by I finally figure it out. It's not ideal but it works.

    Update: I create a post with step by step instructions:

    Thanks to aamit, who provided the link that put me on the right track even that solution in MSDN article doesn't work. Give him +1; he deserves it.

    1.) In FxCop GUI save your project.

    IMPORTANT:

    • a. Save project in the same directory where your solution is.
    • b. Give the FxCop project name the same as your solution name and include the .sln extension.

    For example: If your solution name is MySolution.sln, the FxCop project name is going to be MySolution.sln.FxCop.

    2.) In Visual Studio select Tools -> External Toos

    3.) Enter following information in External Tools dialog box:

    • Title: FxCop
    • Command: C:\Program Files\Microsoft FxCop 1.36\FxCopCmd.exe
    • Arguments: /c /p:"$(SolutionDir)\$(SolutionFileName).fxcop" /cXsl:"C:\Program Files\Microsoft FxCop 1.36\Xml\VSConsoleOutput.xsl"
    • Initial directory: C:\Program Files\Microsoft FxCop 1.36

    Make sure that "Use Output window" checkbox is checked.

    That's it. It works for me I hope it's going to work for you.

    0 讨论(0)
提交回复
热议问题