Search code examples
.netfxcopanalyzersoftware-quality

What is the advantage to use the Microsoft.CodeAnalysis.FxCopAnalyzers nuget over the default Managed Binary Analysis ruleset?


I currently use the Managed Binary Analysis and it looks like the nuget adds the same rules (maybe less).

I also use this SonarQube plugin: https://github.com/SonarQubeCommunity/sonar-fxcop.

What is the nuget for exactly?


Solution

  • I know this question is very old, but I recently had the same question and would like to provide my findings.

    The .NET Compiler Platform ("Roslyn") analyzers offer the following advantages over the legacy FxCop static analysis of managed assemblies:

    • Violations also show up directly in the code editor, just like normal compiler warnings.
    • Violations show up live as you type, not only after builds.
    • Many of the rules also provide code fixes, offered as Visual Studio quick actions.
    • They are the future and will eventually replace static code analysis for managed code.

    The Roslyn analyzers are available either directly in the .NET SDK or as the NuGet package Microsoft.CodeAnalysis.NetAnalyzers

    Source and more information:
    Overview of source code analysis
    Enable or install first-party .NET analyzers