SonarQube MSBuild 集成失败 - SonarQube 7 with Scanner 4.0.2.892 和 VS2017 [英] The SonarQube MSBuild integration failed - SonarQube 7 with Scanner 4.0.2.892 and VS2017

查看:136
本文介绍了SonarQube MSBuild 集成失败 - SonarQube 7 with Scanner 4.0.2.892 和 VS2017的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 MSBuild 4.0.2.892 使用 SonarQube 7.0 和 SonarQube Scanner 并尝试遵循 这些说明 在 Windows (ASP.NET Core) 上扫描我的 .NET 应用程序.下面的三个命令是指令的一部分:

I'm using SonarQube 7.0 and SonarQube Scanner for MSBuild 4.0.2.892 and attempting to follow these instructions to scan my .NET application on Windows (ASP.NET Core). The three commands below are part of the instructions:

C:\SonarQube\Scanner\SonarQube.Scanner.MSBuild.exe begin /k:"org.sonarqube:sonarqube-scanner-msbuild" /n:"TradingPlatform" /v:"1.0"
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" /t:Rebuild
C:\SonarQube\Scanner\SonarQube.Scanner.MSBuild.exe end

然而,虽然预处理在 fist 命令上成功,并且构建在第二个命令上完成,但第三个命令总是失败,如下所示:

However, while pre-processing succeeds on the fist command, and the build completes on the second command, the third command always fails as shown below:

====

适用于 MSBuild 4.0.2 的 SonarQube 扫描仪默认属性文件位于 C:\SonarQube\Scanner\SonarQube.Analysis.xml

SonarQube Scanner for MSBuild 4.0.2 Default properties file was found at C:\SonarQube\Scanner\SonarQube.Analysis.xml

从 C:\SonarQube\Scanner\SonarQube.Analysis.xml 加载分析属性

Loading analysis properties from C:\SonarQube\Scanner\SonarQube.Analysis.xml

后处理开始.

SonarQube MSBuild 集成失败:SonarQube 无法收集有关您的项目的所需信息.

可能的原因:

  1. 项目尚未构建 - 项目必须在开始和结束步骤之间构建
  2. 已使用不受支持的 MSBuild 版本来构建项目.目前支持 MSBuild 14.0 以上
  3. 开始、构建或结束步骤并非都从同一文件夹启动

声纳属性文件的生成失败.无法完成 SonarQube 分析.

Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.

退出代码 1.

====

有谁知道为什么它失败了?原因 1 不可能是这种情况,因为我正在第 2 步中构建项目.原因 2 似乎不太可能(但并非不可能),因为我使用的是 MSBuild 15.原因 3 也不会像我这样从同一位置运行所有三个命令

Does anyone have any idea why it's failing? Cause 1 can't be the case as I'm building the project in step 2. Cause 2 seems very unlikely (but not impossible) as I'm using MSBuild 15. Cause 3 also can't be the case as I'm running all three commands from the same location

推荐答案

其他可能的原因有:

  • 您的构建服务器正在使用本地系统帐户执行构建.尝试将构建用户更改为普通域或本地用户.
  • 您正在构建一个没有 ProjectGuid 属性(默认)并且不属于解决方案的 .NET Core 项目.要解决此问题,您需要执行以下操作之一:
    • 在您的 csproj 的第一个 PropertyGroup 中添加 XXXXX 元素,其中 XXXXX 是新生成的 Guid.
    • 将您的项目添加到 Visual Studio 解决方案并构建 sln 文件而不是 csproj

    如果这没有帮助,请在扫描仪的 begin 命令中添加 /d:sonar.verbose=true 并将所有日志保存到文件中.将构建工作区中的日志和 .sonarqube 文件夹压缩并上传到此处:https://www.dropbox.com/request/CszJAO1ZNXFVl1gwo5hA

    If this does not help, add /d:sonar.verbose=true on the begin command of the scanner and save all logs into a file. Zip the logs and the .sonarqube folder from your build workspace and upload them here: https://www.dropbox.com/request/CszJAO1ZNXFVl1gwo5hA

    这篇关于SonarQube MSBuild 集成失败 - SonarQube 7 with Scanner 4.0.2.892 和 VS2017的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆