Reputation: 266
We build or dotnet core 1.1 projects on our own linux build agents in docker. (https://github.com/Microsoft/vsts-agent-docker) We would like to use Sonar to analyze our C# code. But it seems that the SonarQube MsBuild Scanner can't run in linux environment. Does anybody know a workaround for this. We don't really want to use Windows agents just to do the code analyzing.
Is it possible to run the scanner with mono? If so, is it supported by the sonar steps in tfs 2017? (https://dev.nexogen.hu/tfs/_gallery/items?itemName=sonarsource.sonarqube&targetId=cf345037-b065-4a16-9091-c30d56bf0798)
Can we expect the dotnet core port of the SonarQube MsBuild Scanner in the near future?
Upvotes: 3
Views: 5188
Reputation: 4932
There's also a nice approach using .NET global tools that doesn't require you to version or download Sonar binaries manually.
dotnet tool install --global dotnet-sonarscanner
It still needs JRE installed though. See my answer here for further details.
Upvotes: 1
Reputation: 2781
Now it is possible to run a sonar analisys on linux if you're using .NET Core 2.0 by doing the following:
dotnet <path to SonarScanner.MSBuild.dll> begin /k:"project-key"
dotnet build
dotnet <path to SonarScanner.MSBuild.dll> end
There is more info here
Upvotes: 4