1

我正在使用 SonarQube 5.2 来计算指标。当我使用“”运行它时,一切正常Developer Command Prompt for VS2013

但是,当我使用具有或不具有管理员权限的普通命令提示符“ cmd.exe”运行相同的命令时,我收到以下错误

C:\Windows\system32>"C:\sonarqube-5.2\bin\MSBuild.SonarQube.Runner.exe" end
SonarQube Scanner for MSBuild 1.1
Default properties file was found at C:\sonarqube-5.2\bin\SonarQube.Analysis.xml

Loading analysis properties from C:\sonarqube-5.2\bin\SonarQube.Analysis.xml
Post-processing started.
MSBuild SonarQube Runner Post-processor 1.0.2.0
11:39:29.774  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
11:39:29.774  Loading the SonarQube analysis config from C:\Windows\system32\.sonarqube\conf\SonarQubeAnalysisConfig.xml
11:39:29.774  Not running under TeamBuild
11:39:29.774  Analysis base directory: C:\Windows\system32\.sonarqube
Build directory:
Bin directory: C:\Windows\system32\.sonarqube\bin
Config directory: C:\Windows\system32\.sonarqube\conf
Output directory: C:\Windows\system32\.sonarqube\out
Config file: C:\Windows\system32\.sonarqube\out
Generating SonarQube project properties file to C:\Windows\system32\.sonarqube\out\sonar-project.properties
No ProjectInfo.xml files were found. Possible causes: you specified an invalid build configuration or the custom MSBuild analysis targets were not imported.
Writing processing summary to C:\Windows\system32\.sonarqube\out\ProjectInfo.log

Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
11:39:29.79  Creating a summary markdown file...
Post-processing failed. Exit code: 1

请让我知道可能是什么问题以及如何解决它。

我遵循以下步骤,

  1. 从一个位置执行所有命令示例 - “ D:\Test
  2. 在 PATH 环境变量中添加以下内容 a. MSBUILD 12.0 文件夹的路径
  3. 为分析指标而执行的命令,a。MSBuild.SonarQube.Runner.exe 开始 b。MSBuild abc.csproj /t:Clean;Rebuild /p:VisualStudioVersion=12.0...; c。MSBuild.SonarQube.Runner.exe结尾
4

2 回答 2

4

我得到了解决方案。

我应该使用 MSBuild 的完整路径,而不是将其放在 PATH 变量中,这会导致 SonarQube Analysis 出现此问题。

-->

  1. MSBuild.SonarQube.Runner.exe 开始
  2. "%programfiles(x86)%\msbuild\12.0\bin\MSBuild.exe" abc.csproj /t:Clean;重建 /p:VisualStudioVersion=12.0...;
  3. MSBuild.SonarQube.Runner.exe 结束

<--

我认为,任何需要开发人员命令提示符的命令也应该在正常命令提示符下工作,前提是 MSBUILD 的路径应该是完整的。

问候,大师

于 2016-02-22T05:41:59.890 回答
0

这运作良好。:)

每次执行完成后,一一使用下面的代码:

SonarQube.Scanner.MSBuild.exe 开始 /k:"ProjectKeyName" /n:"ProjectName" /v:"1.0"

"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" /t:重建

SonarQube.Scanner.MSBuild.exe 结束

笔记:

请将 ProjectKeyname 和 projectName 替换为您的(根据在您的项目根文件夹下创建的 sonar-project.properties 文件)

使用的版本:sonarqube-5.6.6(也在 sonarqube-6.4 中测试过),sonar-scanner-msbuild-3.0.0.629

于 2017-07-14T07:04:05.860 回答