Deprecated because StyleCop doesn't rely on Roslyn and is therefore not well-integrated into the Visual Studio 2015+ environment.
Description / Features
The plugin provides coding rules from StyleCop (at least version 4.7).
It is compatible with SonarC#.
Steps to Analyze a C# Project from the Command Line
- On the SonarQube server:
- On the build / analysis machine install:
MSBuild.exe via Settings > General Settings > C# > StyleCop > Path to MSBuild.exe
StyleCop.dll via Settings > General Settings > C# > StyleCop > Path to StyleCop.dll
- The Microsoft .NET Framework v4.5.2+
- On the build / analysis machine, run the build and analysis:
- Open a Developer Command Prompt for Visual Studio
- Put yourself in the root folder of the project you want to analyze
Run the following commands:
Run the SonarQube runner preparation phase
MSBuild.SonarQube.Runner.exe begin /k:"sonarqube_project_key" /n:"sonarqube_project_name" /v:"sonarqube_project_version"
- Build the project, for example:
"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" /t:Rebuild
- Run the SonarQube runner analysis closing phase
- Follow the link provided at the end of the analysis to browse your project's quality in SonarQube UI.
Steps 1. and 2. need only to be performed once.
Steps 3. and 4. need to be performed for each new analysis.
Custom StyleCop Rules are supported by the rule template "Template for custom StyleCop rules" (CustomRuleTemplate).
StyleCop does not support yet the new C# 6.0 syntax, and therefore the StyleCop Plugin does not either. Until new versions of StyleCop and the StyleCop Plugin are released, all StyleCop rules must be disabled when analyzing C# 6.0 projects.
Note that SonarC# does support C# 6.0.