Does current scanner for .NET (version 11.2.0.135473) support using Visual Studio 2012 MsBuild.exe?

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension): * SonarScanner for .NET - 11.2.0.135473
  • how is SonarQube deployed: zip
  • what are you trying to achieve: scan my .NET project via MsBuild.exe of VS 2012
  • what have you tried so far to achieve this

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

I have a C# .NET project which uses .NET framework 4.8, and the project is always built via Visual Studio 2012, which has MsBuild.exe in the path:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319

It built my .NET project properly, command:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe C:\path\to\my\project\ProjectName.csproj -p:Configuration=Release /t:Rebuild

but after changing directory to my SonarQube directory and executing the same command, I got something wrong:

(SonarCategoriseProject target) ->
  D:\sonar-scanner\sonar-scanner-11.2.0.135473-net-framework\.sonarqube\bin\targets\SonarQube.Integration.targets(267,5
): error MSB4062: The "IsTestByReference" task could not be loaded from the assembly D:\sonar-scanner\sonar-scanner-11.
2.0.135473-net-framework\.sonarqube\bin\SonarScanner.MSBuild.Tasks.dll. Could not load file or assembly 'Microsoft.Buil
d.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The s
ystem cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all it
s dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask
. [C:\path\to\my\project\AnotherProjectName.csproj]

BTW when using MsBuild.exe of Visual Studio 2015 it built the project successfully in my SonarQube directory. Command:

"C:\Program Files (x86)\MSBuild\14.0\Bin\amd64\MSBuild.exe" C:\projects\ueip-v5\UBTService.root\UBTService\UBT_Framework\UBT_Framework.csproj -p:Configuration=Release /t:Rebuild

Therefore, a reasonable guess is current .NET scanner does not support MsBuild.exe of VS 2012? If yes, is it suggested that I use MsBuild.exe VS2015 to do the scan even if my project is always built & released via VS2012 (Or does the scan result of using a different version of MsBuild.exe reliable since build scenario is not aligned to the real case)?

Hi,

Welcome to the community!

This looks like a %PATH% question to me. I would expect both your build tool, and the Sonar Scanner to be in your path, so that you could cd into your project directory and run the relevant commands from there.

 
Ann