Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

Live example

Icon

If you want to see a live example of the capabilities of the C# plugin, you can have a look at the analysis of the MyBatis.Net project and the C# solution on Nemo.

Icon

This page documents version 3.0 of the C# plugin. For prior versions, browse this page.

Unable to render {include} The included page could not be found.

Description / Features

The plugin enables analysis of C# with SonarQube. It offers coding rules provided directly by the plugin, as well as integration with FxCop.

Note that multi-language .NET solutions (C# + VB.NET) can be analyzed with the SonarQube platform.

Installation

  1. Install the plugin through the Update Center or download it into the SONARQUBE_HOME/extensions/plugins directory
  2. Restart the SonarQube server

Additional installation steps

FxCop must be installed on the analysis machine in order to use the FxCop rules embedded in the plugin.

You may also want to install the Analysis bootstrapper for Visual Studio projects, which eases the configuration burden by reading your .sln and proj files to automatically set module-level configurations for you. 

Running an Analysis

The SonarQube Runner is recommended for analyzing C# solutions, but Maven can also be used.

To use SonarQube Runner, you must create a sonar-project.properties file in the project root. Typically, this is the same directory that holds your .sln file, but in the case of a Team Foundation Server Build, for instance, where the binaries are extracted to a completely separate directory than the sources, sonar-project.properties would go into the directory that held both the solutions and binaries subdirectories.

If you are using the Analysis bootstrapper for Visual Studio projects, most of the project configuration is handled for you, but a minimal sonar-project.properties file is required. Without the bootstrapper, each module of a project must be manually configured in sonar-project.properties.

Code Coverage

To display code coverage data:

  1. Prior to the SonarQube analysis, execute your unit tests and generate the NCover3 or OpenCover reports.
  2. Import these reports while running the SonarQube analysis by setting the sonar.cs.ncover3.reportsPaths property to the path to the NCover3 reports (separated by commas if there are several reports) or the sonar.cs.opencover.reportsPaths property to the path to the OpenCover reports. The path may be absolute or relative to the project base directory.

Extending Coding Rules

Metric Definitions

See Metric definitions page.

Change Log

Version 3.0

Carefully read Upgrade from the .NET Ecosystem.

 

  • No labels