1
votes

I'm having issues trying to execute the SonarQube Scanner. The begin part seems to run without issues, and also the MSBuild command, but the end part fails.

1st step: I execute the following SonarQube Scanner command:

D:\workspace\MasterData>SonarQube.Scanner.MSBuild.exe begin /k:"masterdata" /n:"MasterData" /v:"1.0" /d:sonar.host.url=http: //xyz.com.br:9000/sonarqube /d:sonar.login=5773c2ca935fde42c72494a96de5a68a5b6899d1 /d:sonar.verbose=true

SonarQube Scanner for MSBuild 2.2
Default properties file was found at D:\sonar-scanner-msbuild-2.2.0.24\SonarQube.Analysis.xml

Loading analysis properties from D:\sonar-scanner-msbuild-2.2.0.24\SonarQube.Analysis.xml

sonar.verbose=true was specified - setting the log verbosity to 'Debug'

Pre-processing started.

Preparing working directories...

Using environment variables to determine the download directory...

Removing the existing directory: D:\workspace\MasterData\.sonarqube

Creating directory: D:\workspace\MasterData\.sonarqube

SonarQube server URL: http: //xyz.com.br:9000/sonarqube

SonarQube Scanner for MSBuild 2.2

15:11:10.032  Loading analysis properties from D:\sonar-scanner-msbuild-2.2
.0.24\SonarQube.Analysis.xml

15:11:10.04  sonar.verbose=true was specified - setting the log verbosity to 'Debug'

15:11:10.042  Updating build integration targets...

15:11:10.045  Installed SonarQube.Integration.ImportBefore.targets to C:\Users\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore

15:11:10.046  Installed SonarQube.Integration.ImportBefore.targets to C:\Users\f
g009adm\AppData\Local\Microsoft\MSBuild\12.0\Microsoft.Common.targets\ImportBefore

15:11:10.048  Installed SonarQube.Integration.targets to D:\workspace\MasterData\.sonarqube\bin\targets

15:11:10.049  Creating config and output folders...

15:11:10.049  Creating directory: D:\workspace\MasterData\.sonarqube\conf

15:11:10.049  Creating directory: D:\workspace\MasterData\.sonarqube\out

15:11:10.055  Fetching analysis configuration settings...

15:11:10.062  Fetching properties for project 'masterdata' from http: //xyz.com.br:9000/sonarqube/api/properties?resource=masterdata...

15:11:10.062  Downloading from http: //xyz.com.br:9000/sonarqube/api/properties?resource=masterdata...

15:11:10.214  Downloading from http: //xyz.com.br:9000/sonarqube/api/updatecenter/installed_plugins...

15:11:10.239  Fetching quality profile for project 'masterdata' from http: //xyz.com.br:9000/sonarqube/api/qualityprofiles/search?projectKey=masterdata...

15:11:10.24  Downloading from http: //xyz.com.br:9000/sonarqube/api/qu
alityprofiles/search?projectKey=masterdata...

15:11:10.272  Downloading from http: //xyz.com.br:9000/sonarqube/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=
500&activation=true&qprofile=cs-sbs-cs-default-201410-86215&p=1...

15:11:10.451  Downloading from http: //xyz.com.br:9000/sonarqube/api/rules/search?f=internalKey&ps=500&activation=false&qprofile=cs-sbs-cs-default-201410-86215&p=1&languages=cs...

15:11:10.506  Generating rulesets...

15:11:10.506  Generating the FxCop ruleset: D:\workspace\MasterData\.sonarq
ube\conf\SonarQubeFxCop-cs.ruleset

15:11:10.518  Writing Roslyn generated ruleset to D:\workspace\MasterData\.sonarqube\conf\SonarQubeRoslyn-cs.ruleset...

15:11:10.534  Writing Roslyn analyzer additional file to D:\workspace\MasterData\.sonarqube\conf\cs\SonarLint.xml...

15:11:10.536  Provisioning analyzer assemblies for cs...

15:11:10.538  Installing required Roslyn analyzers...

15:11:10.538  Local analyzer cache: C:\Users\fg009adm\AppData\Local\Temp\7\.sonarqube\.static

15:11:10.538  Processing plugin: csharp version 1.23.0.1828

15:11:10.54  Cache hit: using plugin files from C:\Users\AppData\Local\Temp\7\.sonarqube\.static\csharp_1.23.0.1828\SonarAnalyzer-1.23.0.1828.zip

15:11:10.566  Pre-processing succeeded.

2nd step: I execute the following MSBuild command:

MSBuild.exe /t:Rebuild MasterDataWebServices.sln

Since the MSBuild log is quite big, I will not provide it here. There is a Build succeeded message, with 5 warnings and 0 errors.

3rd step: I execute the following SonarQube Scanner end command:

D:\workspace\MasterData>SonarQube.Scanner.MSBuild.exe end
SonarQube Scanner for MSBuild 2.2
Default properties file was found at D:\sonar-scanner-msbuild-2.2.0.24\SonarQube.Analysis.xml
Loading analysis properties from D:\sbs1\sonar-scanner-msbuild-2.2.0.24\SonarQube.Analysis.xml

Post-processing started.

SonarQube Scanner for MSBuild 2.2

14:25:22.961  Loading the SonarQube analysis config from D:\workspace\MasterData\.sonarqube\conf\SonarQubeAnalysisConfig.xml

14:25:22.964  Not running under TeamBuild

14:25:22.964  Analysis base directory: D:\workspace\MasterData\.sonarqube

Build directory:
Bin directory: D:\workspace\MasterData\.sonarqube\bin
Config directory: D:\workspace\MasterData\.sonarqube\conf
Output directory: D:\workspace\MasterData\.sonarqube\out

Config file: D:\workspace\MasterData\.sonarqube\conf\SonarQubeAnalysisConfig.xml

Generating SonarQube project properties file to D:\workspace\MasterData\.sonarqube\out\sonar-project.properties

The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
Possible causes:

1. The project has not been built - the project must be built in between the begin and end steps

2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 12.0 upwards are supported

3. The begin, build or end steps have not all been launched from the same folder

Writing processing summary to D:\workspace\MasterData\.sonarqube\out\ProjectInfo.log
Generation of the sonar-properties file failed. Unable to complete SonarQube ana
lysis.

14:25:22.988  Creating a summary markdown file...

14:25:22.989  Post-processing failed. Exit code: 1
1
It looks like you executed the begin step in D:\workspace\MasterData, and the end step in `D:`. You must execute all the steps in the same working directory.janos
Thanks for the comment. I executed again the same commands, taking care of the path, all were executed inside D:\workspace\MasterData, unfortunately the same issue happened.mauricio_casal
I also tried to run these commands with a different C# project, the same issue happened.mauricio_casal

1 Answers

0
votes

I was facing the same problem. In my case I installed corresponding MSBuild version required by my version of Sonar and it worked just fine.

My SonarScanner required version 14.0 or upwards of MSBuild, then I downloaded Microsoft Build Tools 2015.

In your case I believe it this version will work too and if not you can try this version more specifically.

Hope it helps.