SonarSource / sonar-scanner-msbuild

SonarScanner for .NET
http://redirect.sonarsource.com/doc/msbuild-sq-runner.html
GNU Lesser General Public License v3.0
361 stars 143 forks source link

SonarScanner on Linux: Can't see results in SonarQube Dashboard #796

Closed vChriSch closed 5 years ago

vChriSch commented 5 years ago

I really don't have any clue how to solve my Problem. We use SonarScanner for MSBuild and want to analyze our Solution with .Net Core and Standard projects.

There are other Issues without a Solution like: https://github.com/SonarSource/sonar-scanner-msbuild/issues/409

This is our Script: dotnet sonarscanner begin /k:"ProjectName" \ /v:${version} \ /d:sonar.sources=${PWD} \ /d:sonar.verbose=true \ /d:sonar.host.url="http://sonarqubeinstanceurl" \ /d:sonar.language="cs" \ /d:sonar.exclusions="**/bin/**/*,**/obj/**/*" \ /d:sonar.cs.opencover.reportsPaths="${PWD}/TestResults/coverage.opencover.xml" dotnet restore --source http://our.artifactory.instance SonarQube.sln dotnet build --no-restore SonarQube.sln dotnet test --filter TestCategory=Commit -l:trx -r:${PWD}/TestResults /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=${PWD}/TestResults SonarQube.sln dotnet sonarscanner end

The log file looks good to me but I don't see the static codeanalyse in SonarQube UI.

09:23:31 09:23:30.757 INFO: SonarQube Scanner 3.3.0.1492 09:23:31 09:23:30.758 INFO: Java 1.8.0_212 IcedTea (64-bit) 09:23:31 09:23:30.758 INFO: Linux 4.4.180-94.100-default amd64 ...... 09:23:46 09:23:46.264 INFO: Analysis report generated in 1360ms, dir size=3 MB 09:23:47 09:23:47.623 INFO: Analysis reports compressed in 1351ms, zip size=1 MB 09:23:47 09:23:47.624 INFO: Analysis report generated in /var/jenkins/workspace/Project/.sonarqube/out/.sonar/batch-report 09:23:47 09:23:47.624 DEBUG: Upload report 09:23:48 09:23:48.127 DEBUG: POST 200 http://sonarqubeinstance/api/ce/submit?projectKey=Project | time=500ms 09:23:48 09:23:48.129 INFO: Analysis report uploaded in 505ms 09:23:48 09:23:48.130 INFO: ANALYSIS SUCCESSFUL, you can browse http://sonarqubeinstance/dashboard/index/Project 09:23:48 09:23:48.134 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report 09:23:48 09:23:48.135 INFO: More about the report processing at http://sonarqubeinstance/api/ce/task?id=AW0pga80nYWX9GCzdK_O 09:23:48 09:23:48.135 DEBUG: Report metadata written to /var/jenkins/workspace/Project/.sonarqube/out/.sonar/report-task.txt 09:23:48 09:23:48.138 DEBUG: Post-jobs : 09:23:48 09:23:48.142 INFO: Task total time: 15.058 s 09:23:48 09:23:48.251 INFO: ------------------------------------------------------------------------ 09:23:48 09:23:48.251 INFO: EXECUTION SUCCESS 09:23:48 09:23:48.252 INFO: ------------------------------------------------------------------------ 09:23:48 09:23:48.252 INFO: Total time: 17.778s 09:23:48 09:23:48.328 INFO: Final Memory: 12M/131M 09:23:48 09:23:48.328 INFO: ------------------------------------------------------------------------ 09:23:48 Process returned exit code 0 09:23:48 The SonarQube Scanner has finished 09:23:48 09:23:48.346 Post-processing succeeded.

grafik

Do we have forgotten anything? Should it work in this way?

vChriSch commented 5 years ago

I spent so much time to figure out what is the Problem, and now I solved it!

I saw this in the log:

00:02:36.584  09:30:14.328 INFO: Sensor C# [csharp]
00:02:36.584  09:30:14.328 DEBUG: OS is not Windows. Skip Sensor.

Maybe an Build Break and a userfriendly Message like "This feature is available in version 6.7+" would be goog at that place.

I found this Comment on GitHub: https://github.com/SonarSource/sonar-dotnet/issues/2133#issuecomment-443135586

We wer'e using 6.5 and I tested it on 7.6 and it was working directly.

duncanp-sonar commented 5 years ago

@vChriSch thanks for the update and the suggestion.

For reference, we strongly recommend asking support questions in the community forum: https://community.sonarsource.com/. It's monitored by more SonarSourcers and community members so your question is likely to be answered more quickly (if the answer isn't already available in the forum).