Run Code Analysis task fails on Azure DevOps Server

Template for a good bug report, formatted with Markdown:

  • versions used (SonarQube, Scanner, Plugin, and any relevant extension)
    On prem installation of SonarQube version 8.9.2.46101
    Azure Devops Server 2020 with SonarQube extension

  • error observed (wrap logs/code around triple quote ``` for proper formatting)

Starting: Run Code Analysis
==============================================================================
Task         : Run Code Analysis
Description  : Run scanner and upload the results to the SonarQube server.
Version      : 5.0.0

Author       : sonarsource
Help         : Version: 5.0.0. This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

[More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
==============================================================================
E:\agent\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.0.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe end
SonarScanner for MSBuild 5.3.2
Using the .NET Framework version of the Scanner for MSBuild
Post-processing started.
16:05:41.436  16:05:41.405  Uninstalling target: E:\agent\_work\3\.sonarqube\bin\targets\SonarQube.Integration.targets
16:05:41.436  16:05:41.436  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
16:05:41.436  Loading the SonarQube analysis config from E:\agent\_work\3\.sonarqube\conf\SonarQubeAnalysisConfig.xml
16:05:41.436  TeamBuild environment detected
16:05:41.436  Analysis base directory: E:\agent\_work\3\.sonarqube
Build directory: E:\agent\_work\3
Bin directory: E:\agent\_work\3\.sonarqube\bin
Config directory: E:\agent\_work\3\.sonarqube\conf
Output directory: E:\agent\_work\3\.sonarqube\out
Config file: E:\agent\_work\3\.sonarqube\conf\SonarQubeAnalysisConfig.xml
16:05:41.436  Generating SonarQube project properties file to E:\agent\_work\3\.sonarqube\out\sonar-project.properties
##[error]16:05:41.436  The SonarScanner for 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.25420.1 and higher 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)
16:05:41.436  The SonarScanner for 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.25420.1 and higher 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)
16:05:41.436  Generation of the sonar-properties file failed. Unable to complete the analysis.
16:05:41.436  Writing processing summary to E:\agent\_work\3\.sonarqube\out\ProjectInfo.log
##[error]16:05:41.436  Post-processing failed. Exit code: 1
16:05:41.436  Post-processing failed. Exit code: 1
##[error]The process 'E:\agent\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.0.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe' failed with exit code 1
Finishing: Run Code Analysis

  • steps to reproduce
  1. Added tasks to standard .net project in Azure Devops Server 2020
    2.Run build solution task successfully,
  2. Run “Prepare analysis on SonaQube” successfully, here is output.
Starting: Prepare analysis on SonarQube
==============================================================================
Task         : Prepare Analysis Configuration
Description  : Prepare SonarQube analysis configuration
Version      : 5.0.0
Author       : sonarsource
Help         : Version: 5.0.0. [More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
==============================================================================
E:\agent\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.0.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe begin /k:MRManager
SonarScanner for MSBuild 5.3.2
Using the .NET Framework version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories...
16:05:40.014  16:05:39.999  Loading analysis properties from E:\agent\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.0.0\classic-sonar-scanner-msbuild\SonarQube.Analysis.xml
16:05:40.014  16:05:40.014  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
16:05:40.014  Updating build integration targets...
16:05:40.014  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\releasesrvc\AppData\Local\Microsoft\MSBuild\4.0\Microsoft.Common.targets\ImportBefore
16:05:40.014  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\releasesrvc\AppData\Local\Microsoft\MSBuild\10.0\Microsoft.Common.targets\ImportBefore
16:05:40.014  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\releasesrvc\AppData\Local\Microsoft\MSBuild\11.0\Microsoft.Common.targets\ImportBefore
16:05:40.014  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\releasesrvc\AppData\Local\Microsoft\MSBuild\12.0\Microsoft.Common.targets\ImportBefore
16:05:40.014  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\releasesrvc\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore
16:05:40.014  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\releasesrvc\AppData\Local\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportBefore
16:05:40.014  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\releasesrvc\AppData\Local\Microsoft\MSBuild\Current\Microsoft.Common.targets\ImportBefore
16:05:40.03  Installed SonarQube.Integration.targets to E:\agent\_work\3\.sonarqube\bin\targets
16:05:40.03  Creating config and output folders...
16:05:40.03  Creating directory: E:\agent\_work\3\.sonarqube\conf
16:05:40.03  Creating directory: E:\agent\_work\3\.sonarqube\out
16:05:40.046  Downloading from http://alpine:9000/api/server/version...
16:05:40.061  Checking validity of server license
16:05:40.061  Downloading from http://alpine:9000/api/editions/is_valid_license...
16:05:40.061  SonarQube Community Edition detected, license is valid.
16:05:40.061  Fetching analysis configuration settings...
16:05:40.077  Fetching properties for project 'MRManager' from http://alpine:9000/api/settings/values?component=MRManager...
16:05:40.077  Downloading from http://alpine:9000/api/settings/values?component=MRManager...
16:05:40.139  Downloading from http://alpine:9000/api/languages/list...
16:05:40.139  Fetching quality profile for project 'MRManager' from http://alpine:9000/api/qualityprofiles/search?project=MRManager...
16:05:40.155  Downloading from http://alpine:9000/api/qualityprofiles/search?project=MRManager...
16:05:40.186  Fetching rules for quality profile 'AXyaZdhD5iJ5qFAz8DjH' from http://alpine:9000/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&qprofile=AXyaZdhD5iJ5qFAz8DjH&p=1...
16:05:40.186  Downloading from http://alpine:9000/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&qprofile=AXyaZdhD5iJ5qFAz8DjH&p=1...
16:05:40.467  Local analyzer cache: C:\Users\releasesrvc\AppData\Local\Temp\.sonarqube\resources
16:05:40.467  Writing Roslyn generated ruleset to E:\agent\_work\3\.sonarqube\conf\Sonar-cs.ruleset...
16:05:40.483  Writing Roslyn generated ruleset to E:\agent\_work\3\.sonarqube\conf\Sonar-cs-none.ruleset...
16:05:40.483  Provisioning analyzer assemblies for cs...
16:05:40.483  Installing required Roslyn analyzers...
16:05:40.483  Processing plugin: csharp version 8.22.0.31243
16:05:40.561  Cache hit: using plugin files from C:\Users\releasesrvc\AppData\Local\Temp\.sonarqube\resources\2
16:05:40.561  Processing plugin: vbnet version 8.22.0.31243
16:05:40.561  Cache hit: using plugin files from C:\Users\releasesrvc\AppData\Local\Temp\.sonarqube\resources\3
16:05:40.561  Writing Roslyn analyzer additional file to E:\agent\_work\3\.sonarqube\conf\cs\SonarLint.xml...
16:05:40.561  Fetching quality profile for project 'MRManager' from http://alpine:9000/api/qualityprofiles/search?project=MRManager...
16:05:40.561  Downloading from http://alpine:9000/api/qualityprofiles/search?project=MRManager...
16:05:40.577  Fetching rules for quality profile 'AXyaZd4A5iJ5qFAz8ENz' from http://alpine:9000/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&qprofile=AXyaZd4A5iJ5qFAz8ENz&p=1...
16:05:40.577  Downloading from http://alpine:9000/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&qprofile=AXyaZd4A5iJ5qFAz8ENz&p=1...
16:05:40.67  Local analyzer cache: C:\Users\releasesrvc\AppData\Local\Temp\.sonarqube\resources
16:05:40.67  Writing Roslyn generated ruleset to E:\agent\_work\3\.sonarqube\conf\Sonar-vbnet.ruleset...
16:05:40.67  Writing Roslyn generated ruleset to E:\agent\_work\3\.sonarqube\conf\Sonar-vbnet-none.ruleset...
16:05:40.67  Provisioning analyzer assemblies for vbnet...
16:05:40.67  Installing required Roslyn analyzers...
16:05:40.67  Processing plugin: csharp version 8.22.0.31243
16:05:40.67  Cache hit: using plugin files from C:\Users\releasesrvc\AppData\Local\Temp\.sonarqube\resources\2
16:05:40.67  Processing plugin: vbnet version 8.22.0.31243
16:05:40.67  Cache hit: using plugin files from C:\Users\releasesrvc\AppData\Local\Temp\.sonarqube\resources\3
16:05:40.67  Writing Roslyn analyzer additional file to E:\agent\_work\3\.sonarqube\conf\vbnet\SonarLint.xml...
16:05:40.702  Pre-processing succeeded.
Finishing: Prepare analysis on SonarQube

  • potential workaround

P.S.: use the #bug:fault sub-category if you’re hitting a specific crash/error , or the #bug:fp sub-category for rules-related behaviour

Hi @Michael_Lavatman - welcome to the community.

  • please give us the verbose output of the command (please run SonarScanner.MSBuild.exe begin /k:“MyProject” /d:sonar.verbose=true as the begin step, and please attach the output of thje BEGIN and END steps)
  • also,could you provide detailed logs for the MSBuild step please?

Thanks.