Skip to end of metadata
Go to start of metadata

Setting Shared Analysis Parameters

Analysis parameters can be set globally for all projects through the SonarQube user interface.

To share analysis parameter among a subset of projects, place the values in an XML settings file:

SonarQube.Analysis.xml
<?xml version="1.0" encoding="utf-8" ?>
<SonarQubeAnalysisProperties  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sonarsource.com/msbuild/integration/2015/1">
  <Property Name="sonar.verbose">true</Property>
</SonarQubeAnalysisProperties>

The path to this XML file must be passed using the "/s:path" syntax on the command line or using the Setttings File value in the Team Foundation Server 2015 Begin Build Step.

Not all parameters can be specified in this file

The parameter "sonar.projectBaseDir" cannot be used within this shared file.

Setting Per-Project Analysis Parameters

This is not a common use case

Most analysis parameters such as "sonar.verbose" cannot be set on a per-project basis.

Since SonarC# 6.7 / SonarVB 4.2, most of the properties set in projects are ignored without any warning.

Some analysis parameters can be set for a single MSBuild project by adding them to its .csproj file.

.csproj
<ItemGroup>
  <SonarQubeSetting Include="sonar.stylecop.projectFilePath">
    <Value>$(MSBuildProjectFullPath)</Value>
  </SonarQubeSetting>
</ItemGroup>

Setting Per-Analysis Parameters

You can specify properties on the analysis command line using /d. As an example

/d:sonar.host.url=https://myserver.com:9000
  • No labels