none
FxCop VS. VS-2012 Code Analysis

Answers

  • Version considerations aside, FxCop and VS Code Analysis are essentially the same thing.  They use the same core analysis engine and ship with the same core set of rules.  FxCop has two main advantages over VS Code Analysis:

    1.  It costs a lot less (free download vs at least VS Premium license).
    2.  It has a dedicated UI application that can be useful in some scenarios.

    VS Code Analysis has its own set of advantages:

    1.  It offers strong integration with Visual Studio.
    2.  It includes additional rules beyond those shipped with the free version.
    3.  It also includes an additional analysis engine that is not included with the free version.  (This would not actually provide a benefit beyond the additional rules from #2 that are based on this engine unless you're planning on authoring some very fancy custom rules of your own.)

    For routine use, VS Code Analysis provides a smoother workflow, and the extra rules are a definite advantage.  However, there's at least one scenario where I would actually recommend use of stand-alone FxCop over VS Code Analysis, and that's clean-up of a large code analysis backlog.  The FxCop UI application offers some significant benefits for both the exploratory and day-to-day logistics of a backlog cleanup (http://msmvps.com/blogs/calinoiu/archive/2007/06/02/fxcop-backlog-tools-fxcop.aspx).  Unfortunately, there is no stand-alone FxCop UI (yet?) that is compatible with the VS 2012 code analysis assemblies so, as Amanda has already mentioned, version considerations may constrain your choices at the moment.

    HTH,

    Nicole

    Wednesday, June 12, 2013 1:11 PM
  • Hello,

    Based on the link provided by Nicole, code analysis is included in all editions of Visual Studio 2012.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, June 14, 2013 1:32 AM
    Moderator

All replies

  • Hello,

    Thank you for your post.

    As far as I know, FxCop is a code analysis tool that checks managed code assemblies for conformance to Microsoft .NET Framework design guidelines plus custom guidelines.
    It uses introspection, MSIL parsing, and calls graph analysis to inspect assemblies for more than 200 defects in the following areas: Library design, Localization, Naming conventions, Performance, Security. Introspection is described as a new faster, engine for performing Reflection on .NET classes.
    FxCop is intended for class library developers. However, anyone creating applications that should comply with the .NET Framework best practices will benefit. FxCop is also useful as an educational tool for people who are new to the .NET Framework or who are unfamiliar with the .NET Framework Design Guidelines.
    The main advantages of introspection engine are it performs a more extensive analysis than reflection, multithreading, analysis of assemblies of different versions of the framework, ability to Managed Extensions for C++ executables, and non-locking behavior.
    FxCop includes both GUI and command line versions of the tool. It also provides XML based test reports. You can write custom rules based on your company standards and add-up in FxCop tool to test your assembly.

    But FxCop doesn’t have the 11.0 version which can support code analysis outside of VS2012. You need use VisualStudio 2012 Code Analysis to analyze code assemblies.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, June 12, 2013 1:48 AM
    Moderator
  • Version considerations aside, FxCop and VS Code Analysis are essentially the same thing.  They use the same core analysis engine and ship with the same core set of rules.  FxCop has two main advantages over VS Code Analysis:

    1.  It costs a lot less (free download vs at least VS Premium license).
    2.  It has a dedicated UI application that can be useful in some scenarios.

    VS Code Analysis has its own set of advantages:

    1.  It offers strong integration with Visual Studio.
    2.  It includes additional rules beyond those shipped with the free version.
    3.  It also includes an additional analysis engine that is not included with the free version.  (This would not actually provide a benefit beyond the additional rules from #2 that are based on this engine unless you're planning on authoring some very fancy custom rules of your own.)

    For routine use, VS Code Analysis provides a smoother workflow, and the extra rules are a definite advantage.  However, there's at least one scenario where I would actually recommend use of stand-alone FxCop over VS Code Analysis, and that's clean-up of a large code analysis backlog.  The FxCop UI application offers some significant benefits for both the exploratory and day-to-day logistics of a backlog cleanup (http://msmvps.com/blogs/calinoiu/archive/2007/06/02/fxcop-backlog-tools-fxcop.aspx).  Unfortunately, there is no stand-alone FxCop UI (yet?) that is compatible with the VS 2012 code analysis assemblies so, as Amanda has already mentioned, version considerations may constrain your choices at the moment.

    HTH,

    Nicole

    Wednesday, June 12, 2013 1:11 PM
  • Hello Nicole & Amanda!

    Thank you so much for your very detailed answers.
    So these features are not included in the Professional version of VS2012?

    Best regards, Timo

    Thursday, June 13, 2013 8:23 AM
  • Hello,

    FxCop doesn’t have the 11.0 version which can support code analysis outside of VS2012.

    Please see: http://social.msdn.microsoft.com/Forums/en-US/vstscode/thread/6c85e39b-0952-4166-9764-5b37d71adda0

    You can vote here: http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3243367-update-standalone-fxcop-to-support-net-4-5-and-po

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, June 13, 2013 8:29 AM
    Moderator
  • Hello.

    And the VS Code Analysis is only available in Premium license?

    Best regards, Timo

    Thursday, June 13, 2013 11:09 AM
  • Thursday, June 13, 2013 12:19 PM
  • Hello,

    Based on the link provided by Nicole, code analysis is included in all editions of Visual Studio 2012.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, June 14, 2013 1:32 AM
    Moderator
  • If you are running a CI Server other than TFS, you will not be able to run code analysis as part of your build pipeline. FxCop however, can be run as part of this process.


    Craig Berntson
    MCSD, Visual C# MVP
    INETA Community Speaker
    www.craigberntson.com

    Monday, July 08, 2013 9:28 PM
  • Craig,

    Why do you believe this to be the case?  There is no technical impediment to including all Code Analysis rules (including those that run under the Phoenix-based data flow engine) when running fxcopcmd.exe.  Are you aware of any licensing terms that would prevent its use on a non-TFS build server when it would otherwise be useable by all team members (for example, because each team member has an adequate MSDN license)?

    Thanks,

    Nicole

    Tuesday, July 09, 2013 12:32 PM