【问题标题】:SonarQube xproj not supported?不支持 SonarQube xproj?
【发布时间】:2018-01-02 21:02:22
【问题描述】:

我正在尝试配置 SonarQube 以构建 .net 核心项目,构建本身成功,但在完成 SonarQube 分析构建步骤中出现以下错误:

2017-07-27T08:25:21.5598883Z ##[error]No analysable projects were found. SonarQube analysis will not be performed. Check the build summary report for details.

我们正在使用:

  • SonarQube 服务器和扫描仪上的 Java 8
  • SonarQube 6.2 版
  • 适用于 MSBuild 3.0 的 SonarQube 扫描仪
  • 声纳 C# 6.1.0.2359
  • MSBuild 14.0

但是根据 https://jira.sonarsource.com/browse/SONARMSBRU-167,

它已经在 v2.3 中得到解决,因为我们使用的是 v3.0。

xproj 看起来像这样:

..
  <PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
  </PropertyGroup>
  <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
  <PropertyGroup Label="Globals">
    <ProjectGuid>b43fc99f-b98f-4300-9a71-5252e01a602e</ProjectGuid>
    ...
    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
..

它有一个项目 guid,根据https://jira.sonarsource.com/browse/SONARMSBRU-167,这是扫描仪将它们排除在分析之外的主要原因。目标框架已安装在构建服务器中,我们正在使用正确的 msbuild 版本来构建它。

有什么方法可以让 SonarQube 处理 xproj 文件?

【问题讨论】:

    标签: sonarqube .net-core sonarqube-msbuild-runner


    【解决方案1】:

    xproj 格式已被 Microsoft 自己弃用。根据 Microsoft own recommendations,您应该迁移到标准 csproj 格式(使用 Microsoft 迁移页面上提到的工具)。

    根据您的观察,SonarQube .Net 生态系统(SonarC#,Scanner for MSBuild)将支持以 csproj 格式分析您的 .Net Core 项目

    【讨论】:

    • 谢谢 Nicolas,上次有人提出这个问题在 2.3 中得到了修复,从那以后我没有看到任何问题,我认为这与我的配置有关。
    猜你喜欢
    • 2017-07-11
    • 2015-10-23
    • 2017-02-13
    • 2015-07-11
    • 2017-10-15
    • 2017-01-20
    • 1970-01-01
    • 2020-12-16
    • 1970-01-01
    相关资源
    最近更新 更多