gpt4 book ai didi

c# - 如何配置 Teamcitys SonarQube Runner 来分析 C# 文件

转载 作者:行者123 更新时间:2023-12-04 17:36:29 25 4
gpt4 key购买 nike

我正在尝试使用 Teamcity 为 C# 项目设置 SonarQube。问题是没有分析任何 C# 文件。

能否请您仔细检查我的配置,如果我可能遗漏了什么,请告诉我?我完全不明白为什么它不分析任何 C# 文件。

Teamcity configuration

Teamcity configuration (Continued)

Project Analysis

SonarQube plugins, SonarC# is in the list

如果您需要任何其他信息,请告诉我,我会编辑问题。

最佳答案

在附加参数中,尝试添加:

-Dsonar.lanauge=c#

如果它不起作用,请尝试使用命令行运行程序而不是 TeamCity 插件:

第 1 步:

下载并安装 SonarQube MSBuild runner from here .

第 2 步:

使用以下命令在 TeamCity 中的项目构建步骤中创建命令行运行器,不要忘记重新排序此项以使其在 MSBuild 之前运行

SonarQube.Scanner.MSBuild.exe begin /k:"%sonar.project%" /d:"sonar.host.url=%sonar.host.url%" /d:"sonar.login=%sonar.login%" /d:"sonar.organization=%sonar.organization%" /v:"%build.number%"

这使得 SonarQubeRunner 挂接到 MSBuild。

第 3 步:

使用以下命令再次创建命令行构建步骤:

SonarQube.Scanner.MSBuild.exe end /d:"sonar.login=%sonar.login%"

这会将分析发送到 SonarCube。

更新 1:

如您所知,我使用了一些参数,例如 sonar.login 等,不要忘记将它们添加到 TeamCity 的参数中。

sonar.login => 你的登录名

sonar.organization => 组织

sonar.project => 你在 SonarQube 中的项目

sonar.host.url => SonarCube 的主机 url 例如:https://sonarcloud.io

关于c# - 如何配置 Teamcitys SonarQube Runner 来分析 C# 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56537753/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com