'sonar.login' deprecated
Describe the bug
The property 'sonar.login' is deprecated and will be removed in the future. Please use the 'sonar.token' property instead when passing a token. The 'sonar.token' property is available from SonarScanner for .NET version 5.13.
Expected behavior
Use 'sonar.token' property. Link to documentation
/d:sonar.token=<token>
[recommended] Requires version 5.13+. Use sonar.login for earlier versions.
Actual behavior
The property ‘sonar.login’ is used for dotnet-sonar job.
Logs and/or screenshots
Context & Configuration
Link to a project, pipeline or job facing the bug:
- https://gitlab.com/to-be-continuous/dotnet/-/blob/main/templates/gitlab-ci-dotnet.yml?ref_type=heads
The issue was reproduced using:
- Version of the template: (all versions)
- GitLab server(s): (all)
- GitLab runner(s): (no relevant)
- Sonarqube server: (Version v 2025.1 (102418))
Here is the exact lines from template gitlab-ci-dotnet.yml file:
- |
$DOTNET_CLI_HOME/.dotnet/tools/dotnet-sonarscanner begin ${TRACE+/d:sonar.verbose=true} \
/k:"${SONAR_PROJECT_KEY}" \
/d:sonar.login="${SONAR_TOKEN}" \
/d:sonar.host.url="${SONAR_HOST_URL}" \
/d:sonar.cs.opencover.reportsPaths="${CI_PROJECT_DIR}/reports/coverage.opencover.xml" \
/d:sonar.cs.xunit.reportsPaths="${CI_PROJECT_DIR}/reports/dotnet-test.xunitnet.xml" \
$DOTNET_SONAR_EXTRA_ARGS
# build test project
- dotnet build ${TRACE+--verbosity d} "${DOTNET_TEST_PROJECT_DIR}"
- |
$DOTNET_CLI_HOME/.dotnet/tools/dotnet-sonarscanner end /d:sonar.login="${SONAR_TOKEN}"
The fixed lines must as bellow:
- |
$DOTNET_CLI_HOME/.dotnet/tools/dotnet-sonarscanner begin ${TRACE+/d:sonar.verbose=true} \
/k:"${SONAR_PROJECT_KEY}" \
/d:sonar.token="${SONAR_TOKEN}" \
/d:sonar.host.url="${SONAR_HOST_URL}" \
/d:sonar.cs.opencover.reportsPaths="${CI_PROJECT_DIR}/reports/coverage.opencover.xml" \
/d:sonar.cs.xunit.reportsPaths="${CI_PROJECT_DIR}/reports/dotnet-test.xunitnet.xml" \
$DOTNET_SONAR_EXTRA_ARGS
# build test project
- dotnet build ${TRACE+--verbosity d} "${DOTNET_TEST_PROJECT_DIR}"
- |
$DOTNET_CLI_HOME/.dotnet/tools/dotnet-sonarscanner end /d:sonar.token="${SONAR_TOKEN}"
