Getting this IsTestFileByName error upon msbuild. please help

Hi out of nowhere, i am getting this error, when i am building my c-sharp solution with sonarqube. Without sonarqube , the solution builds without errors in visual-studio.

D:\Jenkins\workspace\second-    project\.sonarqube\bin\targets\SonarQube.Integration.targets(201,5): error MSB4018: The "IsTestFileByName" task failed unexpectedly. [D:\Jenkins\workspace\second-project\source\Logger\Logger.csproj]
D:\Jenkins\workspace\second-project\.sonarqube\bin\targets\SonarQube.Integration.targets(201,5): error MSB4018: System.IO.FileNotFoundException: D:\Jenkins\workspace\second-project\3rdparty\sonarqube\msbuild\SonarQube.Analysis.xml [D:\Jenkins\workspace\second-project\source\Logger\Logger.csproj]
D:\Jenkins\workspace\second-project\.sonarqube\bin\targets\SonarQube.Integration.targets(201,5): error MSB4018:    at SonarScanner.MSBuild.Common.Serializer.LoadModel[T](String fileName) [D:\Jenkins\workspace\second-project\source\Logger\Logger.csproj]
D:\Jenkins\workspace\second-project\.sonarqube\bin\targets\SonarQube.Integration.targets(201,5): error MSB4018:    at SonarScanner.MSBuild.Common.AnalysisProperties.Load(String fileName) [D:\Jenkins\workspace\second-project\source\Logger\Logger.csproj]
D:\Jenkins\workspace\second-project\.sonarqube\bin\targets\SonarQube.Integration.targets(201,5): error MSB4018:    at SonarScanner.MSBuild.Common.ConfigSettingsExtensions.GetAnalysisSettings(AnalysisConfig config, Boolean includeServerSettings) [D:\Jenkins\workspace\second-project\source\Logger\Logger.csproj]
D:\Jenkins\workspace\second-project\.sonarqube\bin\targets\SonarQube.Integration.targets(201,5): error MSB4018:    at SonarScanner.MSBuild.Tasks.IsTestFileByName.TryGetRegularExpression(AnalysisConfig config) [D:\Jenkins\workspace\second-project\source\Logger\Logger.csproj]
D:\Jenkins\workspace\second-project\.sonarqube\bin\targets\SonarQube.Integration.targets(201,5): error MSB4018:    at SonarScanner.MSBuild.Tasks.IsTestFileByName.Execute() [D:\Jenkins\workspace\second-project\source\Logger\Logger.csproj]
D:\Jenkins\workspace\second-project\.sonarqube\bin\targets\SonarQube.Integration.targets(201,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [D:\Jenkins\workspace\second-project\source\Logger\Logger.csproj]
D:\Jenkins\workspace\second-project\.sonarqube\bin\targets\SonarQube.Integration.targets(201,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() [D:\Jenkins\workspace\second-project\source\Logger\Logger.csproj]
Done Building Project "D:\Jenkins\workspace\second-project\source\Logger\Logger.csproj" (default targets) -- FAILED.

please help.

Hi @r.kumar,

Could you please add /d:sonar.verbose=true command line argument to the begin step of the Scanner for MSBuild and then send us the complete logs from both steps?

Edit: please, also make sure you are using the current versions of Scanner for MSBuild and Sonar C#.

Kind regards,
Valeri

Hi @Val,

I’m also getting the same exception hence added the verbose=true. Please find the below log steps
Logfile.txt (15.4 KB)

thanks, will try

Hi @Raghavendra_Rao_Itik

What is the command that you are running?

I see that the exception mentions there is no file found at C:\Windows\system32\config\systemprofile\.dotnet\tools\.store\dotnet-sonarscanner\4.5.0\dotnet-sonarscanner\4.5.0\tools\netcoreapp2.1\any\SonarQube.Analysis.xml . Could you double check the folder exists?

I have a same problem. I’m using Sonarqube 8.0 and TFS 2013.

Error:
C:\Builds\25\corp\CSharp_dotnet_4_7_2_Testes.sonarqube\bin\targets\SonarQube.Integration.targets (227): The “IsTestFileByName” task could not be loaded from the assembly C:\Builds\25\corp\CSharp_dotnet_4_7_2_Testes.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 the 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.

The error is normally the result of using an older version of MSBuild that is trying to execute a task that needs a newer version of MSBuild.

What version of MSBuild are you using?

Hi, Duncan.

I runed the comand MSBuild.exe -version in the CMD. And return this messages.

MSBuild.exe -version

Microsoft ® Build Engine version 4.7.3062.0
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright © Microsoft Corporation. All rights reserved.

4.7.3062.0

Thanks,

That version of MSBuild is too old. You need at least MSBuild v14.0.25420.1.

This requirement is listed on the docs page, which also has links to the Microsoft installers for MSBuild.

Good Morning,

Thanks for help me, I will update the MSBuild.

Hi @altamirdiascassiano

Did Duncan’s suggestion work for you?

Thanks,
Costin

Hello Costin,

I’m sorry for the delay.
I needed to change priority this project, I’m working with AzureDevOps first.

Thanks,