1

我正在使用新的 MSBuild SonarQube Runner v1.0 试用 SonarQube。

预处理工作正常

E:\sonarQube\MSBuild.SonarQube.Runner-1.0>MSBuild.SonarQube.Runner.exe begin /k:"MyKey" /n:"MyProject" /v:"1.0"
.......
Process returned exit code 0
Pre-processing succeeded.

然后 MSBuild 工作

E:\sonarQube\WebApplication2013>msbuild
Microsoft (R) Build Engine version 4.0.30319.34209
[Microsoft .NET Framework, version 4.0.30319.34209]
Copyright (C) Microsoft Corporation. All rights reserved.
........

Done Building Project "E:\sonarQube\WebApplication2013\WebApplication2013.sln" (default targets).


Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.51

虽然生成了以下错误的结束命令

E:\sonarQube\MSBuild.SonarQube.Runner-1.0>MSBuild.SonarQube.Runner.exe end
.......
6:35:10 PM  Generating SonarQube project properties file to E:\sonarQube\MSBuild.SonarQube.Runner-1.0\.sonarqube\out\sonar-project.properties
6:35:10 PM  No ProjectInfo.xml files were found. Check that the analysis targets are referenced by the MSBuild projects being built.
6:35:10 PM  Writing processing summary to E:\sonarQube\MSBuild.SonarQube.Runner-1.0\.sonarqube\out\ProjectInfo.log
6:35:10 PM  Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
6:35:10 PM  Creating a summary markdown file...
Process returned exit code 1
Post-processing failed. Exit code: 1

需要你的帮助

4

2 回答 2

2

正如 duncanpMS 的评论所指出的,您需要从要分析的项目的文件夹中运行所有 3 个命令。

方法如下:

  1. cd E:\sonarQube\WebApplication2013
  2. E:\sonarQube\MSBuild.SonarQube.Runner-1.0\MSBuild.SonarQube.Runner.exe begin /k:"MyKey" /n:"MyProject" /v:"1.0"
  3. msbuild /t:rebuild
  4. E:\sonarQube\MSBuild.SonarQube.Runner-1.0\MSBuild.SonarQube.Runner.exe end

您可以添加E:\sonarQube\MSBuild.SonarQube.Runner-1.0%PATH%环境变量中,以便在分析项目时只需MSBuild.SonarQube.Runner.exe从命令行键入而不是完整路径。

于 2015-09-11T09:54:30.553 回答
1

您需要 msbuild 版本 12 或版本 14。如果您有 VS2013 ,则随附 Msbuild 版本 12。如果你有 VS2015,Msbuild 版本 14 自带。

如果没有,请下载 Microsoft Build Tools 2013 或 2015。

Msbuild -version在解决方案文件夹中依次运行 3 个命令之前运行以验证版本。

于 2016-04-06T21:13:10.657 回答