使用TeamCity错误集成SonarQube Msbuild运行程序

时间:2016-08-29 08:23:47

标签: msbuild sonarqube teamcity

我有一个teamcity构建,我已经添加到构建开始和结束操作以进行sonarqube分析,并且在这两个任务之间有一个使用msbuild的构建。当SonarQube插件执行结束阶段时,它会因此错误而失败。

[10:16:52][Step 5/9] Starting: C:\sonarqube\Runner\MSBuild.SonarQube.Runner.exe end
[10:16:52][Step 5/9] in directory: C:\agents\build2\work\a6252c8eea7552b3\src
[10:16:52][Step 5/9] SonarQube Scanner for MSBuild 2.0
[10:16:52][Step 5/9] Default properties file was found at C:\sonarqube\Runner\SonarQube.Analysis.xml
[10:16:52][Step 5/9] Loading analysis properties from C:\sonarqube\Runner\SonarQube.Analysis.xml
[10:16:53][Step 5/9] Post-processing started.
[10:16:53][Step 5/9] SonarQube Scanner for MSBuild End Step 2.1
[10:16:53][Step 5/9] The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
[10:16:53][Step 5/9] Possible causes:
[10:16:53][Step 5/9]   1. The project has not been built - the project must be built in between the begin and end steps
[10:16:53][Step 5/9]   2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 12.0 upwards are supported
[10:16:53][Step 5/9]   3. The begin, build or end steps have not all been launched from the same folder
[10:16:53][Step 5/9] Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
[10:16:53][Step 5/9] 10:16:53.266  Creating a summary markdown file...
[10:16:53][Step 5/9] Post-processing failed. Exit code: 1
[10:16:53][Step 5/9] Process exited with code 1
[10:16:53][Step 5/9] Step Finish SonarQube analysis (Command Line) failed

如果我登录到服务器,打开代理的同一目录并手动执行构建执行的三个步骤。

C:\sonarqube\Runner\MSBuild.SonarQube.Runner.exe begin /k:"Metrics.Net.Es" /n:"Metrics.Net.Es" /v:"1.0"
msbuild mysolution.sln
C:\sonarqube\Runner\MSBuild.SonarQube.Runner.exe end
一切都运行得很好。

可能是什么错误?

1 个答案:

答案 0 :(得分:0)

我找到了解决方案,我需要为TeamCity中的MSBUILD运行操作指定工作目录。在我设置此值后,分析就可以了。如果我将此值留空,则会出现上一个错误。

enter image description here

吉安玛丽亚。