Error MSBuild IsTestFileByName

Hi,

I have issue in running SonarQube

I did

  1. Download and unzip the SonarQube Scanner for MSBuild
  2. And add the executable’s directory to the %PATH% environment variable
  3. Execute SonarQube.Scanner.MSBuild.exe begin …, which succeeded
  4. Execute MSBuild.exe myproject.csrpj /t:Rebuild
    Then I got the following error
    …sonarqube\bin\targets\SonarQube.Integration.targets(212,5): error MSB4062: The “IsTestFileByName” task could not be loaded from the assembly …sonarqube\bin\SonarScanner.MSBuild.Tasks.dll. Could not load file or assembly ‘Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find t
    he file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

I’m using .net 4.0. Latest SonarScanner for MSBuild 4.6.2.2108

Can you please help.

Thank you,
Lin

Hi Lin - welcome to the community.

My guess is that you are building with MSBuild v4 or v12. You need to build using at least MSBuild v14.

Thank you Duncan for the reply.

My MSBuild is v4, is there walk-around for me to use SonarQube it?

No, MSBuild v4 cannot be used as it does not support running Roslyn analyzers.

However, MSBuild is backwards compatible so you should be able to build your projects using MSBuild v14.3, 15 or 16 in exactly the same way as you do with MSBuild v4. The docs page contains a link to the installers for the versions of MSBuild supported by the scanner: https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-msbuild/