I am trying to make use of SonarQube task targeting dotnetcore solution, but the within the solution there are a couple of projects that use dotnetstandard framework. So when attempting to analyze the code, the new SonarQube task throws an error stating that it is unable to locate Microsoft.Build.Utilities.v4.0 as shown below:
2017-07-26T20:33:04.5685747Z
[C:\agent\_work\6\.sonarqube\bin\targets\SonarQube.Integration.targets(166,5): error MSB4062: The "IsTestFileByName" task could not be loaded from the assembly C:\agent\_work\6\.sonarqube\bin\SonarQube.Integration.Tasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the <UsingTask> 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.
[C:\agent\_work\6\s\PSG.Identity.Contracts\PSG.Identity.Contracts.csproj]
2017-07-26T20:33:05.1623435Z ##[error]Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1
The IntegrationTest project is written on dotnetcore framework, but that project references 2 projects that are written on dotnetstandard framework. Is it possible to have this task support multiple frameworks?
With the output you have posted it seems you are using dotnet command dotnet build
or dotnet msbuild
.
According to this link https://www.sonarsource.com/resources/product-news/news.html#2017-04-13-sonarqube-scanner-for-msbuild-2-3-released sonarqube-scanner-msbuild supports only MSBuild 15 or later.
So try using msbuild
directly instead of dotnet
command.
If you are doing this in a ci environment you may need to install msbuild tools 2017. Download is located at the bottom of the page.
Also, make sure you are using sonarqube-scanner-msbuild
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With