Your .NET solution must be compiled if you want prior to use the following plugins:
If your solution is not compiled (or if you do not want to use some of the external tools for your analysis), you can deactivate themthe SonarQube analysis. The SonarQube analysis must be run in the same directory where the solution was compiled.
By default, the C# plugin triggers the execution of some external tools. To deactivate some of them, you can set the below properties:
# External tools to deactivate when the solution is not compiled sonar.fxcop.mode=skip sonar.gendarme.mode=skip sonar.gallio.mode=skip sonar.ndeps.mode=skip # Other external tools that you can deactivate sonar.stylecop.mode=skip
Running an Analysis with the SonarQube Runner
- Compile your solution. SonarQube's primary goal is to analyze source code, so everything has been made to work seamlessly after the compilation of a solution. In other words, if you have a build process that moves the assemblies and packages your application, it is definitely best to run SonarQube before (or in a separate process).
Create a sonar-project.properties file and place it in the same folder as the solution file (.sln):
Code Block title sonar-project.properties language bash
sonar.projectKey=com.mycompany:myCSharpApplication sonar.projectVersion=1.0-SNAPSHOT sonar.projectName=My CSHARP Application # Info required for SonarQube sonar.sources=. # Always set it this way even if this property is not used sonar.language=cs # To prevent any issues while analyzing multiple solutions containing projects with similar keys # Will be set by default to safe starting at version 2.2: http://jira.codehaus.org/browse/SONARDOTNT-339 sonar.dotnet.key.generation.strategy=safe # This property is set because it is required by the SonarQube Runner. # But it is not taken into account because the location of the source # code is retrieved from the .sln and .csproj files. sonar.sources=.
Run the following command from the directory containing the sonar-project.properties file (= the directory containing the solution):
Code Block language none