JetBrains / TeamCity.SonarQubePlugin

A plugin for TeamCity server allowing you to configure and run SonarQube analysis from the CI
Apache License 2.0
53 stars 32 forks source link

SonarQube plugin with .NET 5.0+ and build results #98

Open Traddles opened 2 years ago

Traddles commented 2 years ago

The SonarQube scanner doesn't support .NET 5.0+ according to warning message from execution log: WARN: Your project contains C# files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the SonarScanner for .NET 5.x or higher, see https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html

When using SonarScanner for MSBuild tool the analysis works fine. However, the results of the analysis are not added as a tab in the Build results page.

Is there a way to solve this? And is there a version for the SonarQube scanner tool planned that will support .NET 5.0+ because frankly that seems to be the simplest use case.

Versions used: SonarScanner for MSBuild=5.5.3.43281-net46 SonarQube Scanner=4.7.0.2747 TeamCity Enterprise=2020.2.3 (build 86002) SonarQube Server=9.4 (build 54424) Community Edition

tolache commented 1 year ago

Hi, it looks like you are using the version of SonarScanner for MSBuild incompatible with .NET 5.0+. You will need to download the compatible version of the tool from SonarQube's website and add it to TeamCity.

  1. Go to https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-msbuild/ and download SonarScanner for .NET 5+.
  2. Extract the sonar-scanner-cli-XXXX.jar file from the downloaded file. It is located under sonar-scanner-msbuild-YYYY-net5.0.zip/sonar-scanner-XXXX/lib.
  3. Go to TeamCity > Administration > Tools > SonarQube Scanner > Install versions ... > upload the extracted sonar-scanner-cli-XXXX.jar file.
  4. If necessary, make the uploaded tool version default.
tallior commented 1 year ago

@tolache i tried to follow these steps, but it doesn't work:

Should be single zip, name should contain version, eg: sonar-scanner-msbuild.4.0.2.892.zip