2017-07-28 47 views
5

我正在嘗試使用針對dotnetcore解決方案的SonarQube任務,但解決方案內有一些使用dotnetstandard框架的項目。所以,試圖對代碼進行分析的時候,新的SonarQube任務拋出一個錯誤,指出它無法找到Microsoft.Build.Utilities.v4.0,如下圖所示:SonarQube VSTS Task 3.0.1是否無法支持多種msbuild類型?

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 ## [錯誤]錯誤:C:\ Program Files \ dotnet \ dotnet.exe失敗,返回代碼:1

IntegrationTest項目寫在dotnetcore框架上,但該項目引用了2個項目,這些項目都是用dotnetstandard框架。是否有可能讓這個任務支持多個框架?

+0

也看看[這](https://github.com/GitTools/GitVersion/issues/1175)的討論。 –

回答

1

由於您已發佈的輸出,似乎您正在使用dotnet命令dotnet builddotnet msbuild

根據此鏈接https://www.sonarsource.com/resources/product-news/news.html#2017-04-13-sonarqube-scanner-for-msbuild-2-3-released sonarqube-scanner-msbuild僅支持MSBuild 15或更高版本。

因此請嘗試直接使用msbuild而不是dotnet命令。 如果你是在ci環境中執行此操作,則可能需要安裝msbuild tools 2017。下載位於頁面的底部。

此外,請確保您使用的sonarqube-scanner-msbuild

相關問題