Description / Features
The plugin provides smooth integration between Visual Studio and SonarQube. It reads solution (*.sln) and project (*.csproj, *.vbproj) files to automatically configure many of the required analysis parameters.
- Install the plugin through the Update Center or download it into the SONARQUBE_HOME/extensions/plugins directory
- Restart the SonarQube server
This plugin does not require Visual Studio to be installed.
Once installed, this plugin is enabled globally or on a project-by-project basis via the project settings: Configuration > Settings > Visual Studio Bootstrapper > Enable the analysis bootstrapping or in your properties file by setting
Once enabled, it is invoked in the analysis of projects containing a .sln file. Note that a sonar-project.properties file is still required to specify the basic project configuration.
Custom output paths (applies only if you want to use FxCop / Code Analysis which require assemblies)
By default, assemblies will be sought in the relevant binary directories of each project. If assemblies exist for multiple build configurations, the most recent ones will be used. To specify an alternate location for the solution binaries, set Configuration > Settings > Visual Studio Bootstrapper > Assemblies output paths, or set the
sonar.visualstudio.outputPaths in the sonar-project.properties file.
Test projects can be imported as unit test code (which is not analyzed by coding rules) using the regular expression property "
You can pass per-project settings by prefixing the properties by the project name, for example setting the "
Tests.sonar.cs.vstest.reportsPaths" will set the Visual Studio Test Execution Results report to be used only by the project named "Tests".
Exclude non-built projects from the analysis to avoid the missing assembly error with FxCop
FxCop requires the assemblies of every project to be built. In Visual Studio, you can configure some projects not to be built in some particular build configuration. In such situations, the FxCop analysis will fail complaining that the assemblies are missing. Simply set the "
sonar.visualstudio.skipIfNotBuilt" property to true to automatically skip those projects and prevent the failure of the overall SonarQube analysis.
Exclude projects from the analysis
You can fully exclude projects from the analysis by setting the regular expression property "
sonar.visualstudio.skippedProjectPattern". For example, setting the property to "
.*debug.*" will skip every project whose name contains "debug".