Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
755 views
in Technique[技术] by (71.8m points)

msbuild - 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:SonarQubeinMSBuild.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)JenkinsworkspaceCI"
dotnet clean
dotnet build
C:SonarQubeinMSBuild.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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...