Cannot send build results to SonarQube server

I’m working on a POC and I’m able to create a project and send the build results to SonarQube localhost server without any errors. But when I build the same project and send the the results to production server, build will succeed but the results on the server is empty.

In the server, I’m getting the following warning.

SCM provider autodetection failed. Please use “sonar.scm.provider” to define SCM of your project, or
disable the SCM Sensor in the project settings.

I found that, its not creating the output-cs folder. when i run these commands in local its creating those files and folders but for production server its not.

Path to output-cs

C:\Users\Administrator\Desktop\my-project.sonarqube\out\0

Code I ran for localhost:

C:\Users\Administrator\Desktop\sonar-scanner-msbuild-5.1.0.28487-net46\SonarScanner.MSBuild.exe begin 
/k:"my-test-project"  /d:sonar.verbose=true /d:sonar.host.url="http://localhost:9000" 
/d:sonar.login="project-token"

MsBuild.exe /t:Rebuild

C:\Users\Administrator\Desktop\sonar-scanner-msbuild-5.1.0.28487-net46\SonarScanner.MSBuild.exe end 
/d:sonar.login="project-token"

Code I ran for Production Sever:

C:\Users\Administrator\Desktop\sonar-scanner-msbuild-5.1.0.28487-net46\SonarScanner.MSBuild.exe begin 
/k:"my-test-project" /d:sonar.verbose=true /d:sonar.host.url="http://prod-server-url" 
/d:sonar.login="sonarqube_project_token"

MSBuild.exe /t:Rebuild

C:\Users\Administrator\Desktop\sonar-scanner-msbuild-5.1.0.28487-net46\SonarScanner.MSBuild.exe end 
/d:sonar.login="sonarqube_project_token"

I went through the build stack trace and found some warnings.

WARN: No coverage report can be found with sonar.coverage.jacoco.xmlReportPaths=‘build/reports/jacoco/test/jacocoTestReport.xml’. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml

Doubt:

  1. Do we need to specifically mention some additional parameters when building for server compared to localhost?

Note: This is c# application.

Hi,

There are a couple things here. First the SCM warning is a red herring and unrelated to what you’re seeing.

Are you using the same project in both cases? And the same version of SonarQube?

I believe it has changed in recent versions, but naming your project “Test” or “Test project” can get it treated as composed of only tests - which would result in an empty project dashboard since no lines of “code” would be detected.

Does this resonate with what’s going on for you?

 
Ann