Skip to content
Advertisement

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?

Advertisement

Answer

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

Advertisement