I noticed when running a pipeline in Azure DevOps that I got some warnings on the SonarQube related tasks. It complained that I should update to a newer version. So I thought why not and updated the related tasks to the latest version (7.* at the moment of writing this post).
However when I tried to run the pipeline again afterwards it no longer worked and failed on the Prepare Analysis Task:
Starting: Prepare analysis on SonarQube
==============================================================================
Task : Prepare Analysis Configuration
Description : Prepare SonarQube Server analysis configuration
Version : 7.1.1
Author : sonarsource
Help : [More Information](https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scanners/sonarqube-extension-for-azure-devops/)
==============================================================================
##[error][ERROR] SonarQube Server: Error while executing task Prepare: Use 'scannerMode: dotnet' instead of 'scannerMode: MSBuild' in your task configuration.
##[error]Use 'scannerMode: dotnet' instead of 'scannerMode: MSBuild' in your task configuration.
Finishing: Prepare analysis on SonarQube
Turned out that I was a little bit too fast. After changing the tasks to the latest version I also had to explicitly select the way to run the analysis in the Prepare task:
After (re)checking the radiobutton and saving the pipeline, the error disappeared.