将分析上传到 SonarQube 时出错

Error uploading analysis to SonarQube

我有一个 Sonarcloud 帐户,我正在尝试使用 SonarQube.Scanner.MSBuild.exe 分析 Visual Studio 解决方案。我创建了一个令牌并将其作为 SonarQube.Analysis.xml 文件中的 sonar.login 属性 传递。 我正在使用 https://sonarcloud.io as sonar.host.url, but I've also tried https://sonarqube.com.

这里是配置的相关片段:

<Property Name="sonar.host.url">https://sonarcloud.io</Property>
<Property Name="sonar.login">***my*token****</Property>
<Property Name="sonar.password"></Property>
<Property Name="sonar.organization">MyOrganization</Property>

分析似乎 运行 不错,但最后当它尝试将分析上传到 Sonarcloud 时,我收到此错误:

ERROR: Error during SonarQube Scanner execution
ERROR: You're only authorized to execute a local (preview) SonarQube analysis without pushing the results to the SonarQube server. Please contact your SonarQube administrator.

我已经尝试连接到本地 Sonarqube 服务器并且工作正常。有人知道这里出了什么问题吗?

您可能错过了 sonar.organization 分析 属性。您应该能够从项目主页上的 Organization Key 字段中获取值。如果您的项目在服务器上还不存在,您可以通过登录获取它:我的帐户>组织