This Job is not using VS 2015 to build but with some command line batch executions.
I’m currently facing below issue while trying to perform somarqube analysis.
The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
Possible causes:
The project has not been built - the project must be built in between the begin and end steps
An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0 upwards are supported
The begin, build or end steps have not all been launched from the same folder
Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
15:53:38.051 Creating a summary markdown file…
15:53:38.058 Post-processing failed. Exit code: 1
WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeeded?
ERROR: Execution of SonarScanner for MSBuild failed (exit code 1)
Previous steps failed the build.
Result is: FAILURE
I tried updating SonarQube scanner for MSBuild to latest 4.8 and it worked fine. But the sonarQube build is unable to find the .sln file and throws a error as shown below.
WARNING: The following projects do not have a valid ProjectGuid and were not built using a valid solution (.sln) thus will be skipped from analysis…
No analysable projects were found. SonarQube analysis will not be performed. Check the build summary report for details.
Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
13:18:19.73 Post-processing failed. Exit code: 1
WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeeded?
New run name is ‘#3 Branch rev. 210’
ERROR: Execution of SonarScanner for MSBuild failed (exit code 1)
Archiving artifacts
[htmlpublisher] Archiving HTML reports…
[htmlpublisher] Archiving at BUILD level D:\location\CoverageReport to D:\location\Cs_20Coverage
Recording NUnit tests results
Previous steps failed the build.
Result is: FAILURE
I suspect this line to be root cause of the project not being analyzed":
WARNING: The following projects do not have a valid ProjectGuid
Can you check your .sln file to verify that all referenced projects have GUID set? There as at least one project reported without GUID. That also means that your SLN file was found and processed.
Scanner for MSBuild requires projects to have GUID.
Yea, I just checked the .sln file and all it has about Guid is “SolutionGuid” and its value.
And In jenkins job log it also shows as below:
WARNING: Duplicate ProjectGuid: “00000000-0000-0000-0000-000000000000”. The project will not be analyzed by SonarQube. Project file: “path.configuration.csproj”
so the vales on the right should be unique. You can use randomly generated value, it’s used within the SLN file and in *.csproj file if there’s project reference configured.
SonarScanner for MSBuild does not care about Project-Type-GUID. Use whatever you need here. Project-Type-GUID depends on the project type, so you should keep original values and don’t change them.
Having multiple projects of the same type should have same value.
PFA log :
WARNING: Duplicate ProjectGuid: “00000000-0000-0000-0000-000000000000”. The project will not be analyzed by SonarQube. Project file: “e:\vsts-agent\dcb01_01_sonar_work\r20\a\database-entities-contexts-migrations\businessdbcontext\maintenancedbcontext.csproj”