Why deprecated MsBuild 14/15 warning appears if I am using VS 2022 Build Tools?

Hi,

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 5.13 (Using the .NET Core version of the Scanner for MSBuild)
  • SonarQube: Standalone community, version 10.3.0.82913

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 .csproy 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.

Hi @kricer!
Let’s see if I can help. I have the feeling that you are using an old version of the analyzer, we worked on those warnings back in January, and starting from version 9.19.0.84025, they should report a slightly different message with an improved detection method.
It does this by checking if the Roslyn version:

  • it’s v1, which is associated with Visual Studio 2015 → MsBuild 14:

The analysis using MsBuild 14 is no longer supported and the analysis with MsBuild 15 is deprecated. Please update your pipeline to MsBuild 16 or higher.

  • it’s v2, which is associated with Visual Studio 2017 → MsBuild 15:

The analysis using MsBuild 15 is deprecated. Please update your pipeline to MsBuild 16 or higher.

  • it’s >= v3, then you should see no errors in your logs.

Can you update to the latest SQ version 10.5 and see if the issue still reproduces?