Kemy
Kemy

Reputation: 266

SonarQube MsBuild scanner on linux build agent

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

Answers (3)

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

Fábio Junqueira
Fábio Junqueira

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

Val
Val

Reputation: 2080

At this moment we do not support analysis on other operating systems than Windows and there is no workaround. This is planned for the near future, but we have not started working on it, yet: MMF-484.

Upvotes: 1

Related Questions