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?

Hi Cristian,

I have checked the Roslyn version :‘4.9.0-3.24121.1 (a98c90d5)’
Than it took a while and I installed the latest SQ v10.6 (92116) and the latest SonarScanner for MSBuild 6.2 (although in the logy I can also see “SonarScanner 5.0.1.3006”).

Unfortunately, the warning persists:

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.

Do you have any other suggestion?
Thanks

Hi @kricer, sorry for the delay, I’m back now on the matter.

Ok, we are taking some steps forward. Now the warning is different compared to the previous one and it’s actually reporting

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.

which is the actual warning we log if we detect a Roslyn version 1.x.x associated with Visual Studio 2015 → MsBuild 14.

Can you please verify whether the machine has multiple versions of Visual Studio and/or MSBuild tools installed?