Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I installed like these...

sonarqube-6.2 | sonar-scanner-2.8 | sonar-scanner-msbuild-2.2.0.24 | msbuild 14

And I made windows batch file to build and scan(sonar). but some projects are ok. but some projects are failed.

batch file is...

MSBuild.SonarQube.Runner.exe begin /k:%PROJECT_KEY% /n:%PROJECT_NAME% /v:%BUILD_VERSION% /d:sonar.verbose=true

MSBuild.exe "projects" /t:build /v:m

MSBuild.SonarQube.Runner.exe end

error message is...

SonarQube Scanner for MSBuild 2.2 Default properties file was found at C:\SONARQUBE\sonar-scanner-msbuild-2.2.0.24\SonarQube.Analysis.xml Loading analysis properties from C:\SONARQUBE\sonar-scanner-msbuild-2.2.0.24\SonarQube.Analysis.xml Post-processing started. SonarQube Scanner for MSBuild 2.2 18:50:20.591 Loading the SonarQube analysis config from C:\jenkins_slave_buildpc\workspace\amis3_client_sonar.sonarqube\conf\SonarQubeAnalysisConfig.xml 18:50:20.592 Not running under TeamBuild 18:50:20.593 Analysis base directory: C:\jenkins_slave_buildpc\workspace\amis3_client_sonar.sonarqube Build directory: Bin directory: C:\jenkins_slave_buildpc\workspace\amis3_client_sonar.sonarqube\bin Config directory: C:\jenkins_slave_buildpc\workspace\amis3_client_sonar.sonarqube\conf Output directory: C:\jenkins_slave_buildpc\workspace\amis3_client_sonar.sonarqube\out Config file: C:\jenkins_slave_buildpc\workspace\amis3_client_sonar.sonarqube\conf\SonarQubeAnalysisConfig.xml Generating SonarQube project properties file to C:\jenkins_slave_buildpc\workspace\amis3_client_sonar.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 C:\jenkins_slave_buildpc\workspace\amis3_client_sonar.sonarqube\out\ProjectInfo.log Generation of the sonar-properties file failed. Unable to complete SonarQube analysis. 18:50:20.615 Creating a summary markdown file... 18:50:20.617 Post-processing failed. Exit code: 1

I executed same batch file for sonar. but some project is ok. and some project is failed.. What makes this error message?

like image 826
js. c Avatar asked Dec 30 '16 11:12

js. c


2 Answers

I got the similar error when trying to run MSBuild.SonarQube.Runner end command in teamcity. Begin step and MSBuild step to build project was working fine.

When I given full path for runner and MSbuild in teamcity. It worked for me.

C:\SonarQube\sonar-scanner-msbuild-3.0.2.656\MSBuild.Sonarqube.runner.exe 
begin /k:"Sonar key here" /n:"Sonar project here" /v:%build.number% 
/d:sonar.log.level=DEBUG 

"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" [path for .sln file 
here] /t:Rebuild 
/p:VisualStudioversion=14.0;Configuration=Release;Platform="Any CPU"

C:\SonarQube\sonar-scanner-msbuild-3.0.2.656\MSBuild.Sonarqube.runner end
like image 152
Anil Avatar answered Oct 17 '22 00:10

Anil


Another thing worth checking--especially if you're trying to run SonarQube from a build server--is whether it is operating in the local system profile. From the logs, you may see something like:

Installed SonarQube.Integration.ImportBefore.targets to C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportBefore

I found that this path did not exist, even though SonarQube's scanner happily claimed to have installed its targets there. My solution was to create a build agent account for executing the build tasks. This will cause SonarQube to install its targets to the user profile MSBuild folder. For example:

C:\Users\buildagent\AppData\Local\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportBefore
like image 1
john-shaskin Avatar answered Oct 17 '22 00:10

john-shaskin