- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
- SonarQube - 9.9.1
- CSharp plugin 8.51.0.59060
- vbnet version 8.51.0.59060
- SonarScanner for MSBuild 5.12
- MSBuild version 17.3.2+561848881 for .NET
- how is SonarQube deployed: zip, Docker, Helm
- docker
- what are you trying to achieve
- run a sonar scan on my .NET project
I am trying to run a scan on my .NET project but I am hit with a MSB4018 error. I have reviewed other topics related to this on the forum which suggests that usually this is caused by outdated versions. As far as I am aware it does not seem to be the case, if it is please let me know.
The logs of the error:
|2023-10-31 11:31:30,094|[INFO]|MSBuild version 17.3.2+561848881 for .NET
|2023-10-31 11:31:31,588|[INFO]|/<ROOT_PATH>/.sonarqube/bin/targets/SonarQube.Integration.targets(241,5): error MSB4018: The IsTestFileByName task failed unexpectedly. [/<ROOT_PATH>/Message/Address/Address.csproj]|
|2023-10-31 11:31:31,588|[INFO]|/<ROOT_PATH>/.sonarqube/bin/targets/SonarQube.Integration.targets(241,5): error MSB4018: System.IO.FileNotFoundException: /opt/sq/SonarQube.Analysis.xml [/<ROOT_PATH>/Message/Address/Address.csproj]|
|2023-10-31 11:31:31,588|[INFO]|/<ROOT_PATH>/.sonarqube/bin/targets/SonarQube.Integration.targets(241,5): error MSB4018: at SonarScanner.MSBuild.Common.Serializer.LoadModel[T](String fileName) [/<ROOT_PATH>/Message/Address/Address.csproj]|
|2023-10-31 11:31:31,589|[INFO]|/<ROOT_PATH>/.sonarqube/bin/targets/SonarQube.Integration.targets(241,5): error MSB4018: at SonarScanner.MSBuild.Common.AnalysisProperties.Load(String fileName) [/<ROOT_PATH>/Message/Address/Address.csproj]|
|2023-10-31 11:31:31,589|[INFO]|/<ROOT_PATH>/.sonarqube/bin/targets/SonarQube.Integration.targets(241,5): error MSB4018: at SonarScanner.MSBuild.Common.ConfigSettingsExtensions.GetAnalysisSettings(AnalysisConfig config, Boolean includeServerSettings, ILogger logger) [/<ROOT_PATH>/Message/Address/Address.csproj]|
|2023-10-31 11:31:31,589|[INFO]|/<ROOT_PATH>/.sonarqube/bin/targets/SonarQube.Integration.targets(241,5): error MSB4018: at SonarScanner.MSBuild.Tasks.IsTestFileByName.Execute() [/<ROOT_PATH>/Message/Address/Address.csproj]|
|2023-10-31 11:31:31,589|[INFO]|/<ROOT_PATH>/.sonarqube/bin/targets/SonarQube.Integration.targets(241,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() /[<ROOT_PATH>/Message/Address/Address.csproj]|
|2023-10-31 11:31:31,589|[INFO]|/<ROOT_PATH>/.sonarqube/bin/targets/SonarQube.Integration.targets(241,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/<ROOT_PATH>/Message/Address/Address.csproj]|
The .csproj looks as following:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
Thanks