将 SonarQube 集成到 TFS 2013 中:无法定位代码覆盖率命令行工具

问题描述:

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

I am trying to integrate SonarQube with TFS 2013 and trying to build a solution using 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

I have followed everything from the documentation provided by the 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.

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

Please guide me in the right direction to solve this.

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

A Visual Studio installation providing CodeCoverage.exe is required to be on the build machine with the MSBuild SonarQube Runner TFS integration. This limitation will be solved with the upcoming 1.0.1 release: https://jira.sonarsource.com/browse/SONARMSBRU-130