SonarScanner.MSBuild.exe failed with return code: 1

msbuild
sonarqube

(spy008) #1

I have TFS vNext builds that randomly fail on “Run Code Analysis” task with the below error. It would fail even when nothing has changed in between builds.

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 14.0 and 15.0 are supported 3. The begin, build and end steps have not all been launched from the same folder 4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
10:12:29.718 Post-processing failed. Exit code: 1
C:\BuildAgents\Agent3\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.3.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe failed with return code: 1

I have confirmed that the solution and project have been built in between the begin and end steps. The MSBuild version is 14.0, which is supported. The begin and end steps seem to have been launched from the same folder. I have also turned on Sonar verbosity.
These are the versions I’m using:

  • SonarQube: 5.6.7
  • Sonar Analyzer csharp version: 6.4.1.3596
  • SonarScanner for MSBuild 4.3.1
  • MSBuild 14.0
  • Visual Studio 2015
  • TFS 2017 Update 2 (on-premise)
  • SonarQube Extension 4.2.0
  • Java Runtime 8 Update 144

I need help in troubleshooting this error and fix it. Please help!