SonarQube scanner not working with MSBuild 16 for VS 2019

Must-share information (formatted with Markdown):

  • I am using SonarQube Scanner for MSBuild 3.0.2
  • Trying to scan code written in C# 8.0 and buid using MSBuild 16 using VS 2019
  • The problem is that SonarQube failed with the following message:

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 upwards are supported
  3. The begin, build or end steps have not all been launched from the same folder

Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.

  • As you see below, TeamCity build step is using MSBuild for VS 2019:
    Starting: C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MsBuildBootstrap.exe /workdir:C:\BuildAgent\work\868896d0d76834a0 "/msbuildPath:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\bin\MSBuild.exe"

Can it be that I am suing Sonarscaner for MSBuild 3.0.2 and not the latest one 4.10?

Hi @Rodrigo_Sedano

Indeed, support for MSBuild 16 as been added starting Scanner for MSBuild 4.6.

HTH,
Mickaël