将SonarQube集成到TFS 2013:无法找到代码覆盖命令行工具

时间:2015-08-31 09:29:32

标签: visual-studio-2013 sonarqube tfs2013

我正在尝试将SonarQube与TFS 2013集成,并尝试使用Visual Studio 2013构建解决方案。

我已经按照SonarQube提供的文档中的所有内容进行了操作。 https://github.com/SonarSource/sonar-.net-documentation/releases/download/1.1.0/SonarQube-Setup-Guide-For-Net-Users-V-1-1-0.pdf

这是我得到的日志。

Overall Build Process

00:18
Overall build process

00:00
Update build number

00:18
Run on agent (reserved build agent Default Agent - cvm-511)

00:00
Initialize environment

00:02
Get sources from Team Foundation Version Control

00:00
Associate the changesets that occurred since the last good build

00:10
Compile, Test and Publish

00:03
Run optional script before MSBuild

00:07
Run MSBuild

00:05
Built $/TeleHealthEx/HeathExService/HeathExService.sln for default targets.

00:03
Built $/TeleHealthEx/HeathExService/HealthExDAL/HealthExDAL.csproj for default targets.

00:00
Built $/TeleHealthEx/HeathExService/HealthExUtility/HealthExUtility.csproj for default targets.

00:00
Built $/TeleHealthEx/HeathExService/HealthExModels/HealthExModels.csproj for default targets.

00:00
Built $/TeleHealthEx/HeathExService/HealthExEF/HealthExEF.csproj for default targets.
 AppointmentInfoDA.cs (32): The variable 'ex' is declared but never used
 AppointmentInfoDA.cs (52): The variable 'ex' is declared but never used
 DoctorDetailsDL.cs (82): The variable 'ex' is declared but never used

00:01
Built $/TeleHealthEx/HeathExService/HealthExModels/HealthExModels.csproj for default targets.

00:02
Built $/TeleHealthEx/HeathExService/HealthExEF/HealthExEF.csproj for default targets.

00:00
Built $/TeleHealthEx/HeathExService/HealthExModels/HealthExModels.csproj for default targets.

00:03
Built $/TeleHealthEx/HeathExService/HealthExBAL/HealthExBAL.csproj for default targets.

00:00
Built $/TeleHealthEx/HeathExService/HealthExModels/HealthExModels.csproj for default targets.

00:00
Built $/TeleHealthEx/HeathExService/HealthExDAL/HealthExDAL.csproj for default targets.
 BookMarkBL.cs (73): The variable 'ex' is declared but never used
 BookMarkBL.cs (99): The variable 'ex' is declared but never used
 DoctorDetailsBL.cs (68): The variable 'ex' is declared but never used

00:01
Built $/TeleHealthEx/HeathExService/PayU/PayU.csproj for default targets.

00:01
Built $/TeleHealthEx/HeathExService/HealthExVidyo/HealthExVidyo.csproj for default targets.

00:00
Built $/TeleHealthEx/HeathExService/HealthExUtility/HealthExUtility.csproj for default targets.

00:04
Built $/TeleHealthEx/HeathExService/HealthExService1/HealthExService.csproj for default targets.

00:00
Built $/TeleHealthEx/HeathExService/HealthExUtility/HealthExUtility.csproj for default targets.

00:00
Built $/TeleHealthEx/HeathExService/HealthExModels/HealthExModels.csproj for default targets.

00:00
Built $/TeleHealthEx/HeathExService/HealthExBAL/HealthExBAL.csproj for default targets.
MSBuild Log File

00:00
Run optional script after MSBuild

00:00
Run optional script before Test Runner

00:00
Run VS Test Runner

00:00
**Run optional script after Test Runner
 2:26:05 PM  Failed to locate the code coverage command line tool
 Post-processing failed. Exit code: 1
 Exception Message: TF270015: 'MSBuild.SonarQube.Runner.exe' returned an unexpected exit code. Expected '0'; actual '1'. See the build logs for more details. (type UnexpectedExitCodeException)
Exception Stack Trace:    at     System.Activities.Statements.Throw.Execute(CodeActivityContext context)
   at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
   at     System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)**

00:00
Handle Exception

00:00
Create a bug for the build failure

00:00
Rethrow the exception so the build will stop

00:01
Perform Final Actions On Agent

00:01
Copy binaries to drop

00:00
Reset the Environment
Work item '669: Build Failure in Build: HealthExServiceBuild_20150831.5' was opened by the build.

请指导我正确的方向来解决这个问题。

2 个答案:

答案 0 :(得分:0)

提供CodeCoverage.exe的Visual Studio安装需要在具有MSBuild SonarQube Runner TFS集成的构建计算机上。即将发布的1.0.1版本将解决此限制:https://jira.sonarsource.com/browse/SONARMSBRU-130

答案 1 :(得分:0)

不幸的是,CodeCoverage.exe是Visual Studio 2013 Premium及更高版本和Visual Studio 2015 Enterprise附带的覆盖工具的一部分。

enter image description here

我担心让这项功能运行将需要在构建服务器上安装更高级别的Visual Studio。

MSDN page explaining the coverage feature也提到了这个限制:

  

<强>要求

     
      
  • Visual Studio Enterprise
  •   

And

  

您是否拥有正确版本的Visual Studio?

     

您需要Visual Studio Enterprise。