| Table of Contents |
General Questions
Do I really need Java in order to analyze my C# projects?
Actually you do not!
The analysis can be triggered either by the SonarQube Runner or by maven. Both are Java programs so what is the trick? The SonarQube Runner works fine with IKVM. IKVM is a very nice open source project which implements java in .net. If you want to try it with the SonarQube Runner, you just need to edit the script sonar-runner.bat and replace the call to java by a call to IKVM:
In place of java, a .net process will be used. IKVM will recompiled on the fly the java jars used for the analysis to .net dll files. The recompilation will slow down significantly the analysis. IKVM could be used to transform jar files to dll files prior to any execution (using ikvmc). The problem is that the SonarQube Runner downloads plugins jar files at the beginning of the analysis from the target SonarQube server instance. Hence we cannot pre compiled all the jars files needed to run an analysis without changing the way the runner works.
Right now it is not very useful to use IKVM with the SonarQube Runner. However, this looks very promising for a future Visual Studio integration ![]()
How can I exclude a project from the analysis of a .NET solution?
You can do so using the standard sonar.skippedModules property (see Analysis Parameters for more details). It is a comma-separated list of project names. The names that you must use here are the identifiers that you can find in the .SLN file: the identifier is the first string you can find right after the equals sign on a project definition.
For instance, on the following SLN file excerpt, you would use "FooProject":
SonarQube C# Parser Limitations
- Pre-processing directives are not supported
- Parsing errors may occur with the '?' operator in specific circumstances (e.g. http://old.nabble.com/Problem-with-C--Squid-sensor-tt32091064.html#a32091064)
Tests and code coverage
How can I run Gallio and PartCover on a 64-bits Windows?
Gallio and PartCover work perfectly out-of-the-box on x86 Windows, but not on 64-bits versions of this OS. To make them work correctly, here's what you have to do:
- Download the latest Gallio x64 installer (http://www.gallio.org/Downloads.aspx) and install it in a folder not under "Program Files"
- Download the latest PartCover installer (https://github.com/sawilde/partcover.net4, click on Downloads) and install it in a folder not under "Program Files"
Run "corflags.exe" on Gallio and PartCover executables:
(Source: http://www.planetgeek.ch/2009/10/15/get-partcover-running-on-x64-windows/)
How can I run integration tests ?
Set the sonar.gallio.it.mode property:
Integration tests must be part of the analysed solution. They can either be located in dedicated projects or located in regular test projects, next to unit tests.
If there are located in dedicated projects, theses projects need to be specified using property sonar.dotnet.visualstudio.itProjectPattern. Below an example :
If integration tests are next to unit tests, in the same projects, you need to specify which ones are unit tests and which ones are integration tests. Gallio filters comes to the rescue:
With the preceding configuration fragment, all test cases annotated "unit" (i.e. [Category("unit")]) are considered to be unit test cases whereas test cases annotated "selenium" (i.e. [Category("selenium")]) are considered to be integration test cases.
Integration
How can I integrate SonarQubein my existing TFS Build environment processes?
Most people want to add SonarQube as an additional step in existing processes, which usually brings a lot of troubles because those processes manipulate the generated artifacts (assemblies) - whereas the SonarQubeC# plugins rely best on information found in the source files (mostly CSPROJ config files).
Generally speaking, it's best / easier to set up a separate "continuous inspection" process that just:
- Compiles the solution
- Runs a SonarQubeanalysis
in order to keep the SonarQube-related configuration as simple as possible.
You can read this thread to see how this has been achieved by C# plugin users.

