SonarQube scan Visual Studio 2019 .NET4.7.2

I am trying to scan a very simple Visual Studio 2019 with .NET 4.7.2 with SonarQube and got the error:

image

I am tried to use sonar-scanner-4.2.0.1829 and also 1873 with the same result. The error states “only supported with MSBuild 14 or later”, but I am using MSBuild 16.

Is is possible to scan Visual Studio 2019 projects with SonarQube? If so, what am I doing wrong?

I looked at Error: SonarQube analysis is only supported with MSBuild 14 or later but I don’t understand about MSBuildToolsVersion 4 not been correct here. Would be possible to get more detail about it to understand what is the issue?

Many thanks,

hi @sergioet

are you using SonarScanner for MSBuild ?. What version are you using ? (you provide the version for the scanner-cli which is used underneath by the Scanner for MSBuild)

hi @Andrei_Epure, Yes, I am using sonar-scanner-msbuild-4.7.1.2311

Hi,

Do you have a “ToolsVersion” attribute at project level in your csproj ? In yes, in which version it is set ?

Thanks.

Hi, yes Project ToolsVersion=“15.0”

Did you check all the dependencies as well ?

Sorry, not sure what you mean. This is just a “Hello world” project so it has the default settings, with no other dependencies

Ok, and what does said msbuild when you just type the “msbuild” command in a shell ? Is it in version 16 ?

Ah, indeed I was using the wrong MSBuild, the path env variable was pointing to an old one, thank you!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.