Hi Community,
I’am using the “SonarScanner for .NET” to analyze our dotnet source code. I want that the results are visible on the sonarqube server with the name “terminal-app”. But I always see in our pipeline that the old name “sam-terminal-app” is used instead of “terminal-app”.
How in the documentation described I use the argument “/n: …” to specify the name of the analyzed project.
CI/CD code
sonar_scan:
extends: .windows-runners
stage: quality
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- dotnet C:\tools\Sonar\SonarScanner.MSBuild.dll begin /k:"sam-terminal.SONAR.terminal-app" /n:"terminal-app" /d:sonar.token=$SONAR_TOKEN
- dotnet build ./src/TerminalV3.sln
- dotnet C:\tools\Sonar\SonarScanner.MSBuild.dll end /d:sonar.login=$SONAR_TOKEN
rules:
- if: '$CI_COMMIT_REF_NAME == "main" || $CI_PIPELINE_SOURCE == "merge_request_event"'
allow_failure: true
I have also removed the folders “C:\tools\GitlabRunner\builds” and “C:\tools\GitlabRunner\cache” to ensure that noting is read from cache.
GitlabRunner logs
SonarScanner for MSBuild 5.13
Using the .NET Core version of the Scanner for MSBuild
Post-processing started.
Calling the SonarScanner CLI...
INFO: Scanner configuration file: C:\tools\Sonar\sonar-scanner-4.8.0.2856\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: C:\tools\GitlabRunner\builds\ybdPSipn\0\sam-terminal\terminal-app\.sonarqube\out\sonar-project.properties
INFO: SonarScanner 4.8.0.2856
INFO: Java 17.0.7 Oracle Corporation (64-bit)
INFO: Windows Server 2022 10.0 amd64
INFO: User cache: C:\tools\GitlabRunner\builds\ybdPSipn\0\sam-terminal\terminal-app\.sonar\cache
INFO: Analyzing on SonarQube server 9.9.1.69595
INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=367ms
INFO: Server id: xxxxxxxxx
INFO: User cache: C:\tools\GitlabRunner\builds\ybdPSipn\0\sam-terminal\terminal-app\.sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=94ms
INFO: Load/download plugins (done) | time=10999ms
INFO: Process project properties
INFO: Process project properties (done) | time=91ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=289ms
INFO: Project key: sam-terminal.SONAR.sam-terminal-app
INFO: Base dir: C:\tools\GitlabRunner\builds\ybdPSipn\0\sam-terminal\terminal-app
INFO: Working dir: C:\tools\GitlabRunner\builds\ybdPSipn\0\sam-terminal\terminal-app\.sonarqube\out\.sonar
INFO: Load project settings for component key: 'sam-terminal.SONAR.sam-terminal-app'
INFO: Load project settings for component key: 'sam-terminal.SONAR.sam-terminal-app' (done) | time=69ms
INFO: Load project branches
INFO: Load project branches (done) | time=32ms
....
INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://sonarqube4.devops.xxxxx.de/dashboard?id=sam-terminal.SONAR.sam-terminal-app&branch=main
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
We are using self managed sonarqube instance (Community EditionVersion 9.9.1 (build 69595)) by our company.
Can somebody help what I’am doing wrong ?