简体   繁体   中英

Analysis c# Project with Jenkins and Sonarqube - Error calling MSBuild.SonarQube.Runner.exe end

I am trying to analysis ac# project with SonarQube and Jenkins.

I download the MSBuild SonarQube Runner plugin and I run my analyze to C# Project from the Command Line like this.

cd\\

cd ci\\Test\\CodeCamper

rem --------------- STEP 1 -----------------

MSBuild.SonarQube.Runner.exe begin /k:ProjectCSharp:CodeCamper /n:CodeCamper /v:1.0 /d:sonar.resharper.cs.reportPath="c:\\ci\\test\\codecamper\\resharper.xml" /d:sonar.resharper.solutionFile="c:\\ci\\test\\codecamper\\CodeCamper.sln"

rem --------------- STEP 2 -----------------

C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe "c:\\ci\\test\\codecamper\\CodeCamper.sln" /p:VisualStudioVersion=14.0

rem --------------- STEP 3 -----------------

"C:\\ci\\sonarqube\\AddOn\\JetBrains.ReSharper.CommandLineTools\\inspectcode.exe" /output="c:\\ci\\test\\codecamper\\resharper.xml" "c:\\ci\\test\\codecamper\\CodeCamper.sln"

rem --------------- STEP 4 -----------------

MSBuild.SonarQube.Runner.exe end

Run successfully.

Now I create a job in jenkins and call the cmds in the build step, i choose execute batch windows command. I put inside all the commands like before, and lunch the build.

The step1 , step2 and step3 run successufully, but the step4, ends up with error.

Started by user anonymous Building in workspace C:\\CI\\jenkins\\Jenkins\\jobs\\CodeCamper2\\workspace [workspace] $ cmd /c call C:\\WINDOWS\\TEMP\\hudson2830193841329867261.bat

C:\\CI\\jenkins\\Jenkins\\jobs\\CodeCamper2\\workspace>cd\\

C:>cd ci\\Test\\CodeCamper

C:\\CI\\Test\\CodeCamper>rem --------------- STEP 4 -----------------

C:\\CI\\Test\\CodeCamper>MSBuild.SonarQube.Runner.exe end Default properties file was found at C:\\CI\\sonarqube\\AddOn\\MSBuild.SonarQube.Runner\\SonarQube.Analysis.xml Loading analysis properties from C:\\CI\\sonarqube\\AddOn\\MSBuild.SonarQube.Runner\\SonarQube.Analysis.xml Post-processing started. WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. File: D:\\TEMP.NETFramework,Version=v4.5.AssemblyAttributes.cs, project: c:\\ci\\test\\codecamper\\CodeCamper.Data.Contracts\\CodeCamper.Data.Contracts.csproj WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. File: D:\\TEMP.NETFramework,Version=v4.5.AssemblyAttributes.cs, project: c:\\ci\\test\\codecamper\\CodeCamper.Data\\CodeCamper.Data.csproj WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. File: D:\\TEMP.NETFramework,Version=v4.5.AssemblyAttributes.cs, project: c:\\ci\\test\\codecamper\\CodeCamper.Model\\CodeCamper.Model.csproj WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. File: D:\\TEMP.NETFramework,Version=v4.5.AssemblyAttributes.cs, project: c:\\ci\\test\\codecamper\\CodeCamper.Web\\CodeCamper.Web.csproj The SONAR_RUNNER_HOME environment variable is not required and will be ignored. SONAR_RUNNER_OPTS is not configured. Setting it to the default value of -Xmx1024m Calling the sonar-runner... Files was unexpected at this time. The sonar-runner did not complete successfully 21:38:18.51 Creating a summary markdown file... Post-processing failed. Exit code: 1

C:\\CI\\Test\\CodeCamper>exit 1 Build step 'Execute Windows batch command' marked build as failure Finished: FAILURE.

What i am missing here?

My apologies for my bad english.

Best regards,

Lopes.

Sorry for the late reply but just seen this post, seems your issue is on the sonnarqube end step

MSBuild.SonarQube.Runner.exe end Default properties file was found at C:\CI\sonarqube\AddOn\MSBuild.SonarQube.Runner\SonarQube.Analysis.xml

This could be caused due the XML for configuration is not in the same folder (exe, dll and xml have to be at the same level, in your case at C:\\CI\\sonarqube\\AddOn\\MSBuild.SonarQube.Runner). As it is not there it tried to use a default configuration file but this wont have any of the information required to publish on your sonarqube server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM