SonarScanner for .NET is trying to access the wrong IP address

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube:, Scanner: Sonar-scanner- , Plugin: N/A, and any relevant extension)

  • how is SonarQube deployed: zip

  • what are you trying to achieve: To run a scan on my dotnet project using a different machine than the one that the server is hosted on. I’ve gotten sonarscanner to start and the app builds fine. The only errors pop up when I run the “end” command for sonarscanner. The scanner is trying to access the wrong url ( for some reason and I can’t find out why.

  • what have you tried so far to achieve this: I’ve edited the SonarQube.Analysis.xml folder to contain the right (172.xx.xx.xx:9000/sonarqube) i can confirm this works becuase I am able to connect to it on a different machine. And I’ve also edited the file to have the same host url.

I’m running the code with a jenkins pipeline. Here are the logs:

C:\Jenkins\workspace\master_ws\software\Applications\projectName>“C:\Jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\SonarScanner_for_MSBuild\SonarScanner.MSBuild.exe” end
SonarScanner for MSBuild 5.13
Using the .NET Framework version of the Scanner for MSBuild
Post-processing started.
15:45:39.658 15:45:39.658 WARNING: File ‘C:\Jenkins\workspace\master_ws\log4netTemplate\Template\AppHost\Release\Log4Net.template’ is not located under the base directory ‘C:\Jenkins\workspace\master_ws\software’ and will not be analyzed.
Calling the TFS Processor executable…
The TFS Processor has finished
Calling the SonarScanner CLI…
INFO: Scanner configuration file: C:\Jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\SonarScanner_for_MSBuild\sonar-scanner-\bin..\conf\
INFO: Project root configuration file: C:\Jenkins\workspace\master_ws\software\Applications\VirtekIrisClient.sonarqube\out\
INFO: SonarScanner
INFO: Java 11.0.18 Oracle Corporation (64-bit)
INFO: Windows 10 10.0 amd64
INFO: User cache: C:\Users\build.sonar\cache
ERROR: SonarQube server [] can not be reached
INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.490s
INFO: Final Memory: 4M/17M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution

This is my file:

#Configure here general information about the environment, such as SonarQube server connection details for example
#No information about specific project should appear here

#----- Default SonarQube server

#----- Default source code encoding

this is my SonarQube.Analysis.xml file:

<?xml version="1.0" encoding="utf-8" ?>

<SonarQubeAnalysisProperties  xmlns:xsi="" xmlns:xsd="" xmlns="">
<Property Name="">http://172.xx.xx.xx:9000/sonarqube</Property>
<Property Name="sonar.login">sqxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</Property>


This is my jenkins script:

        stage('SonarQube Analysis'){
            def msbuildHome = tool 'VS 2022'
            def scannerHome = tool 'SonarScanner for MSBuild'
            echo "Starting SonarQube Analysis"
                bat "\"${scannerHome}\\SonarScanner.MSBuild.exe\" begin /k:\"projectName\" /s:\"C:\Jenkins\workspace\master_ws\software\Applications\projectName\SonarQube.Analysis.xml""
                bat "\"${tool 'VS 2022'}\\msbuild.exe\" ${_Internal_Solution_Name}.sln -p:Configuration=Release -p:Platform=\"${_Common_Internal_Paramter_Platform}\" ${_Internal_Nuget_Version_Prefix} -target:Rebuild ${_Define_Constant}"
                bat "\"${scannerHome}\\SonarScanner.MSBuild.exe\" end"

The sonar scanner is also downloaded as a zip file. I’ve also tried running the /s: parameter with the “sonarScanner end” command but that also runs into errors. From what I believe the /s: parameter only works with “begin”.

I’m also open to solutions with the Jenkins plugin. We have also tried to set that up but also came into some problems.

Instead of adjusting the SonarQube.Analysis.xml file, I suggest configuring the SonarQube server via Manage Jenkins > Configure System > SonarQube Servers and then using that configuration via withSonarQubeEnv('My SonarQube Server') as documented here.

If you run into issues, let us know.