Can I run SonarQube code analysis for .NET Core (C

2019-05-23 05:18发布

问题:

I'm trying to execute and report a SonarQube code analysis (without test coverage for now) against a .NET Core project from a Linux build agent.

I downloaded sonar-scanner from this page, and trying to run the report with the following command (the server url is set up in the configuration).

sonar-scanner -Dsonar.projectKey="MyProject" -Dsonar.projectName="MyProject" -Dsonar.sources=$PWD

The execution seems to be successful, I uploaded the full output to this gist.

However, if I go to the project dashboard on the SonarQube site, I don't see any issues or code smells whatsoever.

I wanted to make sure that my project contains at least one error, so I added a goto statement to one of the source files, and checked if that warning is enabled in our Quality Profile, but I still get no issue.
(The sources files themselves are picked up correctly, I can see the list of files and all the source in SonarQube.)

Am I doing something wrong, or is this not expected to work?

(Just to clarify that this is not a duplicate of the existing question about .NET Core: the same command I showed here works for me on Windows, it only does not work on Linux.)

回答1:

This has now been fixed so you should see an error if run this way.

See https://github.com/SonarSource/sonar-csharp/issues/535