The C# Plugins ecosystem consists of the following plugins:
- C# Core : the core plugin that defines API used by every other plugin in the ecosystem
- C# Squid : the plugin that parses C# code source, computes metrics and detects copy-paste (distributed by SonarSource as a freeware)
- C# FxCop : the plugin launches FxCop analyses to detect violations relating to potential bugs, tight coupling, globalization, ...
- C# StyleCop : the plugin launches StyleCop analyses to detect violations primarily relating to coding style (formatting, comments, ...)
- C# Gendarme : the plugin launches Gendarme analyses to detect violations primarily relating to coding bad practices, smell detection, performance, ...
- C# Gallio : the plugin launches Gallio to run tests and gets execution report as well as coverage report (using PartCover, OpenCover or NCover)
- C# NDeps : the plugin launches a dependency parser tool, built on Mono Cecil, to get dependency data between assemblies and classes.
You may not want to install of all these plugins: only the C# Core plugin is mandatory, although it won't do much without the C# Squid plugin. So let's say you need to install at least those 2 plugins. |
Requirements
Below are the requirements to be able to use the C# Plugins:
- Sonar requirements: please first check that you know the requirements for the Sonar platform itself
- C# Plugins Ecosystem requirements
- Your C# code base must be developped with Visual Studio, and thus must contain a ".sln" file (.NET Solution)
- If you want test metrics, unit tests must be isolated from the main code base in dedicated Visual Studio Projects. Also the test framework must be compatible with Gallio.
Supported versions:
C# language
Up to 4.0
.NET framework
2.0, 3.5 and 4.0
Silverlight
3 and 4
Visual Studio
Tested with VS2008 and VS 2010 ".sln" files.
Older versions may be also supported (feel free to give feedback)
Install the C# plugins
- Download the ZIP that contains the latest version of the C# plugins
- Copy the plugins you chose into the "/extensions/plugins" folder of Sonar
Install the required tools
Depending on which plugin you chose to install, you may need to install the corresponding tool.
If you can, we advise you to install the same versions as the one we use for testing (i.e. the one in bold in the above table).
Tool | Install required if plugin selected? | Web site / download / install guide | Versions supported (tested in bold) |
|---|---|---|---|
FxCop | YES | 1.36+ (10.0) | |
StyleCop | NO, StyleCop 4.4 binaries embedded in the plugin | 4.3+ (4.4) | |
Gendarme | NO, Gendarme 2.10 binaries embedded in the plugin | 2.10+ (2.10) | |
Gallio | YES | 3.1 Update 2 + (3.2.3) | |
PartCover | YES if you want to use PartCover as the coverage engine. | https://github.com/sawilde/partcover.net4 | 2.2, 2.3 and 4.0 (4.0) |
NCover | YES if you want to use NCover as the coverage engine | 3.0 (3.0) | |
OpenCover | YES if you want to use OpenCover as the coverage engine. | 1.0.X, 2.0.X (2.0.8) | |
| DependencyParser | NO, binaries embedded in the plugin | https://github.com/grozeille/DependencyParser |
These tools need the .Net framework to be installed. Some notes:
- FxCop10 needs .Net 4 but the other ones will run fine with .Net 3.5.
- StyleCop plugin relies on MsBuild to run the analysis.
This may sound obvious if you are already familiar with Sonar : Sonar analysis is not necessarily performed on the same machine as the one running your Sonar server. This means that you can run Sonar on a linux box and run analysis on Windows boxes. Also you need to install the tools mentioned above on each box where analysis will be performed. |
Check the prerequisites
- Sonar must be correctly installed
- Maven or the Sonar Java Runner must be installed
- Prefer the Java Runner: check how to install it
- Your .NET solution must be compiled if you want to use the following plugins:
- FxCop
- Gendarme
- Gallio
- NDeps
