Message-ID: <194178950.13723.1406632501594.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_13722_1266499202.1406632501594" ------=_Part_13722_1266499202.1406632501594 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Your .NET solution must be compiled prior to the SonarQube analysis. The= SonarQube analysis must be run in the same directory where the solution wa= s compiled.
By default, the C# plugin triggers the execution of some external tools.= To deactivate some of them, you can set the below properties:
Create a sonar-project.properties file and place it in the&= nbsp;same folder as the solution file (.sln):
Run the following command from the directory containing the sona= r-project.properties file (=3D the directory containing the solution):=
Always use "/" instead of "\" (even if it looks weir= d on a Windows box).
When noted, Ant style wildcard patterns can be used.
s any file or directory.
** means any directories and subdirec=
In some advanced use cases (which should not occur too often if you foll= ow our best practices), the following placeholders can be used in path patt= erns:
|$(SolutionDir)||Root directory of the solution, this is the dire= ctory where the ".sln" file is located.|
|$(ProjectName)||Name of the currently analyzed project of the so= lution.|
|$(AssemblyName)||Name of the assembly generated by the currently = analyzed solution. Works only for non-ASP projects.|
|$(AssemblyVersion)||Version of the assembly generated by the current= ly analyzed solution.|
|$(OutputType)||Type of the assembly. Can be "= ;dll" or "exe".|
|$(RootNamespace)||Root namespace of the currently an= alyzed project.|
For example:=20 =20
To set the default version of the .NET SDK to be used, log in as a Syste=
m administrator and go to Settings > Configuration > General =
Settings > .NET and set the
roperty. Note that you can override this default value in your analysis con=
The same parametrization is available for the Silverlight Framework:
By default, generated code is excluded from the analysis (Reference.=
cs or *.designer.cs files):
edCode is set to
To exclude projects, use the sonar.skippedModules property. It is a comm=
a-separated list of project names. The names that must be used are the iden=
tifiers in the solution file: the first string right after the equals sign =
on a project definition.
Known limitation: this property does not currently work while the "so= nar.dotnet.key.generation.strategy" is set to "safe". See&nb= sp;SONARDOTNT-10.
To exclude files, see Project Administration#ExcludingFiles<= /a>.
On some specific components, you can also prevent issues from being rais= ed against a set of coding rules: see the Switch Off Violations plugin.
See NDeps plugin.
Some tools like FxCop or Gendarme require assemblies. Having too few iss= ues most often comes from the following reasons:
Before following this workaround, make sure that you've got strong reaso= ns not to put the analysis configuration file into the folder containing th= e solution. Note that this workaround may lead to further tricky configurat= ion and issues.
The configuration defined to build the solution will be used to locate t= he assemblies during the SonarQube analysis. Two properties are taken into = account:
sonar.dotnet.buildConfigurationproperty (default value is=
sonar.dotnet.buildPlatformproperty (default value is
Let's take the folowing example:
If you use the default configuration (
ube will try to retrieve the assembly of this project in <project_di=
If you set the properties to:
SonarQube will try to retrieve the assembly of this project in <p= roject_directory>/bin/Release.
Depending on when you run SonarQube in your continuous integration proce= ss, it is very important to properly set those properties. A proper configu= ration will allow SonarQube to automatically retrieve the assemblies and sm= oothly perform the analysis. It is highly recommend that you run SonarQube = right after the compilation phase.
For example, if you run SonarQube after the packaging phase that moves a=
ll the assemblies into a single directory, you will face over-complicated c=
onfiguration because you will have to tell SonarQube where to find the asse=
mbly for each project. To do so, set the
sonar.dotnet.assemblies property. It is a path pattern that will be used to find the assembly of=
the analyzed project. The path pattern can be absolute or relative to the =
directory containing the ".csproj" file.
Most people want to add SonarQube as an additional step in existing proc= esses, which usually brings a lot of troubles because those processes manip= ulate assemblies - whereas the SonarQube C# plugins rely best on infor= mation found in the source files (mostly "csproj" files).
Generally speaking, it's better / easier to set up a separate Continuous= Inspection process that only:
in order to keep the SonarQube-related configuration as simple as possib= le.
You can read this thread to see how this has been achieved by C# plugin users.
You are using a 64-bit windows OS. There is an environment variable &quo= t;Platform=3DHPD" that makes msbuild fail. Try to run:
64-bit msbuild cannot be used with Silverlight. Check that you are not u=
sing a 64-bit msbuild by taking a look at
dotnet.3.5.sdk.directory properties. "Framework64" should not be present in the =
The Java process performing the analysis might need more memory. Use the= "-Xmx" option to specify the amount of memory that can be used. = See the SonarQub= e Runner documentation for more details