The tool which generates rules configuration xml for give FxCop assemblies
C#
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
GeneratedFiles
SonarFxCopConfGenerator
README.md
SonarFxCopConfGenerator.sln

README.md

SonarFxCopRulesGenerator

The tool which generates rules configuration xml for give FxCop assemblies

If you want to buid the source file

  • you need to have FxCop installed
  • open the solution file in Visual Studio 2012
  • check the project references and correct them if necessary.
    • FxCopCommon.dll and FxCopSdk.dll are located in %fxcop_home%\FxCopCommon.dll

Note: %fxcop_home% is usually "c:\Program Files (x86)\Microsoft Fxcop 10.0" on 64b OS and "c:\Program Files\Microsoft Fxcop 10.0" on 32b OS

How to generate an XML file for standard FxCop rules

  • execute
SonarFxCopRulesGenerator.exe "%fxcop_home%\rules" YourOutputFile.xml

How to generate an XML file for syour custom FxCop rules

  • execute:
SonarFxCopRulesGenerator.exe "%location_of_your_assemblies%\rules" YourOutputFile.xml

How to generate an XML file for Visual Studio Static Analysis rules

  • copy phx.dll and Microsoft.VisualStudio.CodeAnalysis.Phoenix.dll from "%vs_static_analysis_home%\FxCop" to the folder where your SonarFxCopRulesGenerator.exe is located
  • execute:
SonarFxCopRulesGenerator.exe "%vs_statis_analysis_home%\FxCop\rules" YoutOutputFile.xml

Note: %vs_static_analysis_home% is usually "c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools" on 64b OS and "c:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools" on 32b OS
Note: Visual Studio Static Analysis contains all standard FxCop rules. If you only want to generate an XML file for the rules which are not in FxCop, run the tool with DataFlowRules.dll, MaintainabilityRules.dll and ReliabilityRules.dll assemblies only.

How to use FxCop with Visual Studio Static Analysis rules in sonar

  • copy Microsoft.VisualStudio.CodeAnalysis.DataflowModels.dll, Microsoft.VisualStudio.CodeAnalysis.Phoenix.dll and phx.dll from %vs_static_analysis_home% to %fxcop_home%
  • copy PhoenixAnalysisEngine.dll from %vs_static_analysis_home%\Engines to %fxcop_home%\Engines
  • copy DataFlowRules.dll, MaintainabilityRules.dll and ReliabilityRules.dll rom %vs_static_analysis_home%\Rules to %fxcop_home%\Rules
  • place the configuration files you generated to %sonar_home%\extensions\rules\fxcop
  • restart sonar