2017-07-28 46 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

相关问题