Skip to end of metadata
Go to start of metadata

Documentation about the parameters of C# Squid Plugin (freeware by SonarSource) has been put on this page as well, as those 2 plugins are tightly coupled (one can't be used without the other).
Parameters used by several plugins, such as "build configurations", have been put on this page as well.

Name

Key

Default value

Description

Minimum tokens

sonar.cpd.cs.minimumTokens

100

The number of duplicate tokens above which a block is considered as a duplication in a C# program.

Ignore literals

sonar.cpd.cs.ignoreLiteral

true

if true, CPD ignores literal value differences when evaluating a duplicate block. This means that 'my first text'; and 'my second text'; will be seen as equivalent.

Ignore file headers
(since 2.3)
sonar.cs.ignoreHeaderCommentstrueIf set to false, comments that starts at line 0 of a source file (generally license headers) won't be ignored and will be counted as code comments.

.NET 2.0 SDK directory

sonar.dotnet.2.0.sdk.directory

C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727

Absolute path of the .NET SDK 2.0 directory.

.NET 3.5 SDK directory

sonar.dotnet.3.5.sdk.directory

C:/WINDOWS/Microsoft.NET/Framework/v3.5

Absolute path of the .NET SDK 3.5 directory.

.NET 4.0 SDK directory

sonar.dotnet.4.0.sdk.directory

C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319

Absolute path of the .NET SDK 4.0 directory.

.NET version

sonar.dotnet.version

4.0

Default version of the .NET framework that must be used.

Silverlight 3 assembly directory

sonar.silverlight.3.mscorlib.location

C:/Program Files/Reference Assemblies/Microsoft/Framework/Silverlight/v3.0

Location of the core assembly for Silverlight 3 framework.

Silverlight 4 assembly directory

sonar.silverlight.4.mscorlib.location

C:/Program Files/Reference Assemblies/Microsoft/Framework/Silverlight/v4.0

Location of the core assembly for Silverlight 4 framework.

Silverlight version

sonar.silverlight.version

4

Default version of the Silverlight framework that must be used.

Test project names

sonar.donet.visualstudio.testProjectPattern

*.Tests

Pattern that check project names to identify unit test projects. Multiple patterns may be specified using semicolon as a delimiter.

Integration test project names (since v1.3)sonar.dotnet.visualstudio.itProjectPattern 

Pattern that check project names to identify integration test projects. Multiple patterns may be specified using semicolon as a delimiter. If there is no pattern specified, unit test patterns are used.

Solution to analyse

sonar.dotnet.visualstudio.solution.file

 

Relative path to the ".sln" file that represents the solution to analyse. If none provided, a ".sln" file will be searched at the root of the project.

Exclude generated code

sonar.dotnet.excludeGeneratedCode

true

Set to false to include generated code like 'Reference.cs' files or '*.designer.cs' files.

About path patterns

Ant style patterns can be used. "*" means any file or any directory. "**" means any directory and subdirectory. For example "**/Foo*.dll" means any dll file prefixed by "Foo" anywhere in a project. IF you need to reference assembly files outside your solution folder, you can use absolute paths or "../". For example "$(SolutionDir)/../lib/**.*dll" can be used to specify all the dll files of a lib folder located at the same level as the root folder of your visual studio solution.

 

Advanced parameters

 

Name

Key

Default value

Description

Build configurations

sonar.dotnet.buildConfigurations

Debug

Not needed in most cases.
The build configurations used to build the solution, separated by colons or semi-colons as in "Debug,Release". The sonar plugins use only one value. "Debug" is chosen if present otherwise the first one is picked. Anyway, it is strongly recommended to run a standard debug compilation build prior to any sonar analysis. Some tools such as Mono Gendarme do not have the same behaviors with code compiled in release more and code compiled in debug mode.

Assemblies to scan (since v1.1)

sonar.dotnet.assemblies

 

Not needed in most cases.
Comma-seperated list of path patterns to locate the assemblies of the current visual studio solution. If empty, the plugin will try to get this list from the Visual Studio 'csproj' files. These paths can be absolute or relative, the starting point being the folders where the csproj files are located. Also the special key "$(SolutionDir)" can be used to build a path relative to the root folder of the solution (i.e. where the sln file is located). Do not use this property unless you have no choice. It is recommended to run a standard "debug" compilation build prior to the sonar analysis.

Other advanced parameters

Sonar C# support most parameters described in the Advanced parameters page, at least the non java specific ones.
So feel free to use parameters such as sonar.branch, sonar.skippedModules and so on...

Warning

Each time you need to specify a path, or a pattern to locate files, use "/" instead of "\"

Labels
  • None