The analysis using MsBuild 14 is no longer supported warning with VS 2022 Build Tools

I hope you can help me to remove a warning I do not understand its origin. I have the following environment:

  • Language: c# (.Net Framework v4.8)
  • MsBuild path: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\msbuild.exe
  • SonarScanner: SonarScanner for MSBuild 6.2
  • SonarQube: Standalone community, version v10.6 (92116)

In the SonarQube page of my project, there is a warning displayed The last analysis has warnings, wit the following content:
Analysis using MsBuild 14 and 15 build tools is deprecated. Please update your pipeline to MsBuild 16 or higher.

I do not understand why the SonarScanner detects MsBuild 14 or 15, as I am using version 17 (according to the MsBuild path).

Please also note, that the .csproj files do have properties set ToolsVersion="15.0" or even older, in the Project xml tag but I understand, with newer MsBuild, they get ignored.

Please tell me how to remove the warning.

Thank you.

PS: I have a similar question opened, but I got no response.

Hi,

Can you provide a full, debug analysis log?

Share the Scanner for .NET verbose logs

  • Add /d:"sonar.verbose=true" to the…
    • SonarScanner.MSBuild.exe or dotnet sonarscanner begin command to get more detailed logs
      • For example: SonarScanner.MSBuild.exe begin /k:"MyProject" /d:"sonar.verbose=true"
    • “SonarQubePrepare” or “SonarCloudPrepare” task’s extraProperties argument if you are using Azure DevOps
      • For example:
        - task: SonarCloudPrepare@1
            inputs:
              SonarCloud: 'sonarcloud'
              organization: 'foo'
              scannerMode: 'MSBuild'
              projectKey: 'foo_sonar-scanning-someconsoleapp'
              projectName: 'sonar-scanning-someconsoleapp'
              extraProperties: |
                sonar.verbose=true
        
  • The important logs are in the END step (i.e. SonarQubeAnalyze / SonarCloudAnalyze / “Run Code Analysis”)

Share the msbuild detailed logs

MsBuild.exe /t:Rebuild /v:d

or

dotnet build -v:d

 
Thx,
Ann