Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sonarqube with dotnet core works fine on command line but not from Jenkins

I'm trying to launch Sonarqube on a .NET Core 2.0 solution from Jenkins using SOnarQube MsBuild on Windows.

It works fine when i execute the following script from Jenkins workspace:

C:\SonarQube\bin\MSBuild.SonarQube.Runner.exe begin /k:XXXX.Campaigns /n:CI /v: /d:sonar.host.url=http://x.x.x.x:9000 /d:sonar.verbose=true /d:sonar.projectBaseDir="C:\Program Files (x86)\Jenkins\workspace\CI"
dotnet clean
dotnet build
C:\SonarQube\bin\MSBuild.SonarQube.Runner.exe end

But when i execute the same command from Jenkins, i got this message:

The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects. Possible causes:

  1. The project has not been built - the project must be built in between the begin and end steps.
  2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0 upwards
  3. The begin, build or end steps have not all been launched from the same folder

I use Jenkins 2.46.2 - MSBuild 15 - Sonarqube 6.7 & Sonar MsBuild 4.0.2.892. I tried using Jenkins build steps, command step, command step with a script without success. On a classical .Net 4.5.2 project, it works.

like image 946
Greg Avatar asked Jan 17 '26 10:01

Greg


1 Answers

Jenkins was running as local system user. I change it to a normal Windows user and it did the trick. dotnet build was not using Sonarqube dedicated targets. Thanks you @Valeri!

like image 104
Greg Avatar answered Jan 20 '26 09:01

Greg