Guru
Guru

Reputation: 71

Error while running SonarQube - No ProjectInfo.xml files were found

I am using SonarQube 5.2 for calculating the metrics. Everything works fine, when I run it using "Developer Command Prompt for VS2013".

But when I run the same commands using normal command prompt "cmd.exe" with or without administrator rights, I am getting the following error

C:\Windows\system32>"C:\sonarqube-5.2\bin\MSBuild.SonarQube.Runner.exe" end
SonarQube Scanner for MSBuild 1.1
Default properties file was found at C:\sonarqube-5.2\bin\SonarQube.Analysis.xml

Loading analysis properties from C:\sonarqube-5.2\bin\SonarQube.Analysis.xml
Post-processing started.
MSBuild SonarQube Runner Post-processor 1.0.2.0
11:39:29.774  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
11:39:29.774  Loading the SonarQube analysis config from C:\Windows\system32\.sonarqube\conf\SonarQubeAnalysisConfig.xml
11:39:29.774  Not running under TeamBuild
11:39:29.774  Analysis base directory: C:\Windows\system32\.sonarqube
Build directory:
Bin directory: C:\Windows\system32\.sonarqube\bin
Config directory: C:\Windows\system32\.sonarqube\conf
Output directory: C:\Windows\system32\.sonarqube\out
Config file: C:\Windows\system32\.sonarqube\out
Generating SonarQube project properties file to C:\Windows\system32\.sonarqube\out\sonar-project.properties
No ProjectInfo.xml files were found. Possible causes: you specified an invalid build configuration or the custom MSBuild analysis targets were not imported.
Writing processing summary to C:\Windows\system32\.sonarqube\out\ProjectInfo.log

Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
11:39:29.79  Creating a summary markdown file...
Post-processing failed. Exit code: 1

Please let me know what could be isssue and how to resolve it.

The following steps are followed by me,

  1. Executed all the commands from one location example - "D:\Test"
  2. Added the following in the PATH environment variable a. path to MSBUILD's 12.0 folder
  3. The commands executed for analysis of metrics, a. MSBuild.SonarQube.Runner.exe begin b. MSBuild abc.csproj /t:Clean;Rebuild /p:VisualStudioVersion=12.0...; c. MSBuild.SonarQube.Runner.exe end

Upvotes: 1

Views: 4557

Answers (2)

Ganesh
Ganesh

Reputation: 396

This worked well. :)

Use the below lines code one by one after each exection is completed:

SonarQube.Scanner.MSBuild.exe begin /k:"ProjectKeyName" /n:"ProjectName" /v:"1.0"

"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" /t:Rebuild

SonarQube.Scanner.MSBuild.exe end

Note:

Please replace the ProjectKeyname and projectName with yours (As per sonar-project.properties file created under your Project Root Folder)

Version used: sonarqube-5.6.6 (tested in sonarqube-6.4 as well), sonar-scanner-msbuild-3.0.0.629

Upvotes: 0

Guru
Guru

Reputation: 71

I got the solution.

I should use the full path to MSBuild instead of putting it in the PATH variable, which causes this issue for SonarQube Analysis.

-->

  1. MSBuild.SonarQube.Runner.exe begin
  2. "%programfiles(x86)%\msbuild\12.0\bin\MSBuild.exe" abc.csproj /t:Clean;Rebuild /p:VisualStudioVersion=12.0...;
  3. MSBuild.SonarQube.Runner.exe end

<--

I think, any command that requires Developer Command Prompt, should also work in the normal command prompt, provided the path to MSBUILD should be in full.

Regards, Guru

Upvotes: 4

Related Questions