azure-devops - 在 Azure DevOps 中启动 "run code analysis"时 SonarQube 出现错误

标签 azure-devops sonarqube azure-pipelines

在 Azure DevOps 中启动“运行代码分析”时,显示以下错误:

==============================================================================
Task         : Run Code Analysis
Description  : Run scanner and upload the results to the SonarCloud server.
Version      : 1.6.3
Author       : sonarsource
Help         : This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

[More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
==============================================================================
[command]D:\a\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\1.6.3\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe end
SonarScanner for MSBuild 4.6.2
Using the .NET Framework version of the Scanner for MSBuild
Post-processing started.
17:36:00.872  Fetching code coverage report information from TFS...
17:36:00.872  Attempting to locate a test results (.trx) file...
17:36:00.92  Looking for TRX files in: D:\a\1\TestResults
17:36:00.92  No test results files found
17:36:00.951  Did not find any binary coverage files in the expected location.
17:36:00.951  Falling back on locating coverage files in the agent temp directory.
17:36:00.951  Searching for coverage files in D:\a\_temp
17:36:00.951  No coverage files found in the agent temp directory.
WARNING: The following projects do not have a valid ProjectGuid and were not built using a valid solution (.sln) thus will be skipped from analysis...
D:\a\1\s\Domain.Core\Domain.Core.csproj, D:\a\1\s\Shared\Shared.csproj, D:\a\1\s\API\API.csproj, D:\a\1\s\Domain.Core\Domain.Core.csproj, D:\a\1\s\Shared\Shared.csproj, D:\a\1\s\Domain.Wallet\Domain.Wallet.csproj, D:\a\1\s\Domain.Store\Domain.Stores.csproj, D:\a\1\s\Domain.Order\Domain.Orders.csproj, D:\a\1\s\Domain.Users\Domain.Users.csproj, D:\a\1\s\App\App.csproj, D:\a\1\s\Domain.Core\Domain.Core.csproj, D:\a\1\s\Domain.Core\Domain.Core.csproj, D:\a\1\s\Domain.Store\Domain.Stores.csproj, D:\a\1\s\Shared\Shared.csproj, D:\a\1\s\Domain.Store\Domain.Stores.csproj, D:\a\1\s\Domain.Order\Domain.Orders.csproj, D:\a\1\s\Domain.Core\Domain.Core.csproj, D:\a\1\s\Shared\Shared.csproj, D:\a\1\s\Domain.Store\Domain.Stores.csproj, D:\a\1\s\Domain.Core\Domain.Core.csproj, D:\a\1\s\Shared\Shared.csproj, 
WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed by SonarQube. Project file: "D:\a\1\s\Domain.Core\Domain.Core.csproj"
WARNING: Duplicate ProjectGuid: "00000000-0000-0000-0000-000000000000". The project will not be analyzed by SonarQube. Project file: 
##[error]No analysable projects were found. SonarQube analysis will not be performed. Check the build summary report for details.
No analysable projects were found. SonarQube analysis will not be performed. Check the build summary report for details.
Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
##[error]17:36:01.201  Post-processing failed. Exit code: 1
17:36:01.201  Post-processing failed. Exit code: 1
##[error]D:\a\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\1.6.3\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe failed with return code: 1
##[section]Finishing: Run Code Analysis

所以我无法得到预期的最终报告。

最佳答案

在.Net core中,您必须为每个项目提供特殊的GUID。

所以去你的每个.csproj并在 <PropertyGroup> 内添加这一行:

# Replace the guid here with a new one
<ProjectGuid>{13212313-gd5543-1321-3fdf1-313fdfs13}</ProjectGuid>

您可以为您的项目生成 GUID here .

关于azure-devops - 在 Azure DevOps 中启动 "run code analysis"时 SonarQube 出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56876292/

相关文章:

java - 如何排除自定义插件中的内置规则?

Azure 门户中缺少 Azure DevOps 项目

Azure DevOps - 服务主体不工作

java - 如何修复未注释的主要方法?

azure - 从另一个 Azure DevOps Git 存储库运行 YAML 管道

java - SonarQube 提示 : Either log or rethrow this exception

azure - 如何将管道运行时持续时间导出到 CSV

azure-pipelines - Azure Pipelines - 查看上一次运行的参数

azure-devops - 我可以在Azure Pipelines中对变量进行子字符串化吗?

Azure 构建管道无法检索最新的源版本