Generation of the sonar-properties file failed. Unable to complete SonarQube analysis

Step One

"E:\Tools\SonarQube\MS\MSBuild.SonarQube.Runner.exe" begin /key:"JIQITONG" /name:"JIQITONG" /version:"1.9"

is OK

Step Two

MSBuild.exe "D:\JiQiTongTrunk\ZhengHe.AnHui.Dev.sln" /property:Configuration=Release /p:Platform="Any CPU" /t:rebuild /p:VisualStudioVersion=15.0  is OK

is OK

Step Three

D:\JiQiTongTrunk>"E:\Tools\SonarQube\MS\MSBuild.SonarQube.Runner.exe" end
WARNING: ------------------------------------------------------------------------
This executable is deprecated and may be removed in next major version of the SonarScanner for MSBuild. Please use 'SonarScanner.MSBuild.exe' instead.
------------------------------------------------------------------------
SonarScanner for MSBuild 4.10
Using the .NET Framework version of the Scanner for MSBuild
Post-processing started.
21:42:09.154  21:42:09.149  SonarQube.Integration.ImportBefore.targets does not exist at C:\Users\lenovo\AppData\Local\Microsoft\MSBuild\4.0\Microsoft.Common.targets\ImportBefore
21:42:09.155  21:42:09.15  SonarQube.Integration.ImportBefore.targets does not exist at C:\Users\lenovo\AppData\Local\Microsoft\MSBuild\10.0\Microsoft.Common.targets\ImportBefore
21:42:09.156  21:42:09.15  SonarQube.Integration.ImportBefore.targets does not exist at C:\Users\lenovo\AppData\Local\Microsoft\MSBuild\11.0\Microsoft.Common.targets\ImportBefore
21:42:09.157  21:42:09.15  SonarQube.Integration.ImportBefore.targets does not exist at C:\Users\lenovo\AppData\Local\Microsoft\MSBuild\12.0\Microsoft.Common.targets\ImportBefore
21:42:09.157  21:42:09.15  SonarQube.Integration.ImportBefore.targets does not exist at C:\Users\lenovo\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore
21:42:09.157  21:42:09.15  SonarQube.Integration.ImportBefore.targets does not exist at C:\Users\lenovo\AppData\Local\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportBefore
21:42:09.158  21:42:09.15  SonarQube.Integration.ImportBefore.targets does not exist at C:\Users\lenovo\AppData\Local\Microsoft\MSBuild\Current\Microsoft.Common.targets\ImportBefore
21:42:09.158  21:42:09.154  sonar.log.level=DEBUG was specified - setting the log verbosity to 'DEBUG'
21:42:09.16  Loading the SonarQube analysis config from D:\JiQiTongTrunk\.sonarqube\conf\SonarQubeAnalysisConfig.xml
21:42:09.161  Not running under TeamBuild
21:42:09.161  Analysis base directory: D:\JiQiTongTrunk\.sonarqube
Build directory:
Bin directory: D:\JiQiTongTrunk\.sonarqube\bin
Config directory: D:\JiQiTongTrunk\.sonarqube\conf
Output directory: D:\JiQiTongTrunk\.sonarqube\out
Config file: D:\JiQiTongTrunk\.sonarqube\conf\SonarQubeAnalysisConfig.xml
Generating SonarQube project properties file to D:\JiQiTongTrunk\.sonarqube\out\sonar-project.properties
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.25420.1 and higher are supported.
  3. The begin, build and end steps have not all been launched from the same folder
  4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
Writing processing summary to D:\JiQiTongTrunk\.sonarqube\out\ProjectInfo.log
Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
21:42:09.198  Post-processing failed. Exit code: 1

Why?
I sure four possible problems all is ok。

Version of SonarQuble Server is 8.4.2。
My pc is windows 10。
MsBuild.exe 15.9
Folder“C:\Users\lenovo\AppData\Local\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportBefore” is empty。

What should I do next?

Back to the old version?

Hello @scottcn

Definitely don’t go back to previous version.

  • My first question (something that you hint at but that you don’t make explicit) is Did that process work in the past with a “previous version” ?
    If yes, what did you change between previous version and current version ?
  • Second point is: Can you send the full logs of all the analysis steps from Step One to the final error. And since you will have to re-run the analysis can you add /d:sonar.verbose=true to the begin step (Step 1)
    Only this will allow me to troubleshoot you problem properly

Olivier

Tested according to your method, or not.

Step one full logs:

Microsoft Windows [版本 10.0.19041.572]
© 2020 Microsoft Corporation. 保留所有权利。

D:\04-项目源码\济南市中小企业公共服务中心\Trunk>“E:\Tools\SonarQube\MS\MSBuild.SonarQube.Runner.exe” begin /k:“JIQITONG” /n:“JIQITONG” /v:%build.number% /d:sonar.log.level=DEBUG /d:sonar.verbose=true
WARNING: ------------------------------------------------------------------------
This executable is deprecated and may be removed in next major version of the SonarScanner for MSBuild. Please use ‘SonarScanner.MSBuild.exe’ instead.

SonarScanner for MSBuild 4.3.1
Using the .NET Framework version of the Scanner for MSBuild
Default properties file was found at E:\Tools\SonarQube\MS\SonarQube.Analysis.xml
Loading analysis properties from E:\Tools\SonarQube\MS\SonarQube.Analysis.xml
sonar.verbose=true was specified - setting the log verbosity to ‘Debug’
Pre-processing started.
Preparing working directories…
Using environment variables to determine the download directory…
Removing the existing directory: D:\04-项目源码\济南市中小企业公共服务中心\Trunk.sonarqube
Creating directory: D:\04-项目源码\济南市中小企业公共服务中心\Trunk.sonarqube
21:15:59.648 21:15:59.642 Loading analysis properties from E:\Tools\SonarQube\MS\SonarQube.Analysis.xml
21:15:59.649 21:15:59.648 sonar.verbose=true was specified - setting the log verbosity to ‘Debug’
21:15:59.655 Updating build integration targets…
21:15:59.658 Installed SonarQube.Integration.ImportBefore.targets to C:\Users\lenovo\AppData\Local\Microsoft\MSBuild\4.0\Microsoft.Common.targets\ImportBefore
21:15:59.66 Installed SonarQube.Integration.ImportBefore.targets to C:\Users\lenovo\AppData\Local\Microsoft\MSBuild\10.0\Microsoft.Common.targets\ImportBefore
21:15:59.662 Installed SonarQube.Integration.ImportBefore.targets to C:\Users\lenovo\AppData\Local\Microsoft\MSBuild\11.0\Microsoft.Common.targets\ImportBefore
21:15:59.664 Installed SonarQube.Integration.ImportBefore.targets to C:\Users\lenovo\AppData\Local\Microsoft\MSBuild\12.0\Microsoft.Common.targets\ImportBefore
21:15:59.666 Installed SonarQube.Integration.ImportBefore.targets to C:\Users\lenovo\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore
21:15:59.668 Installed SonarQube.Integration.ImportBefore.targets to C:\Users\lenovo\AppData\Local\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportBefore
21:15:59.67 Installed SonarQube.Integration.targets to D:\04-项目源码\济南市中小企业公共服务中心\Trunk.sonarqube\bin\targets
21:15:59.672 Creating config and output folders…
21:15:59.673 Creating directory: D:\04-项目源码\济南市中小企业公共服务中心\Trunk.sonarqube\conf
21:15:59.674 Creating directory: D:\04-项目源码\济南市中小企业公共服务中心\Trunk.sonarqube\out
21:15:59.685 Fetching analysis configuration settings…
21:15:59.688 Downloading from http://192.168.2.81:9000/api/server/version
21:15:59.736 Fetching properties for project ‘JIQITONG’ from http://192.168.2.81:9000/api/settings/values?component=JIQITONG
21:15:59.738 Downloading from http://192.168.2.81:9000/api/settings/values?component=JIQITONG
21:16:00.269 Downloading from http://192.168.2.81:9000/api/languages/list
21:16:00.7 Fetching quality profile for project ‘JIQITONG’ from http://192.168.2.81:9000/api/qualityprofiles/search?projectKey=JIQITONG
21:16:00.703 Downloading from http://192.168.2.81:9000/api/qualityprofiles/search?projectKey=JIQITONG
21:16:01.156 Fetching active rules for quality profile ‘AXWNL29VuiadNWSZv48z’ from http://192.168.2.81:9000/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&activation=true&qprofile=AXWNL29VuiadNWSZv48z&p=1
21:16:01.159 Downloading from http://192.168.2.81:9000/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&activation=true&qprofile=AXWNL29VuiadNWSZv48z&p=1
21:16:01.704 Fetching rules not active in quality profile ‘AXWNL29VuiadNWSZv48z’ for language ‘cs’ from http://192.168.2.81:9000/api/rules/search?f=internalKey&ps=500&activation=false&qprofile=AXWNL29VuiadNWSZv48z&p=1&languages=cs
21:16:01.707 Downloading from http://192.168.2.81:9000/api/rules/search?f=internalKey&ps=500&activation=false&qprofile=AXWNL29VuiadNWSZv48z&p=1&languages=cs
21:16:02.161 Local analyzer cache: C:\Users\lenovo\AppData\Local\Temp.sonarqube\resources
21:16:02.18 Writing Roslyn generated ruleset to D:\04-项目源码\济南市中小企业公共服务中心\Trunk.sonarqube\conf\SonarQubeRoslyn-cs.ruleset…
21:16:02.208 Writing Roslyn analyzer additional file to D:\04-项目源码\济南市中小企业公共服务中心\Trunk.sonarqube\conf\cs\SonarLint.xml…
21:16:02.219 Provisioning analyzer assemblies for cs…
21:16:02.223 Installing required Roslyn analyzers…
21:16:02.224 Processing plugin: csharp version 7.15.0.8572
21:16:02.305 Cache hit: using plugin files from C:\Users\lenovo\AppData\Local\Temp.sonarqube\resources\2
21:16:02.308 Fetching quality profile for project ‘JIQITONG’ from http://192.168.2.81:9000/api/qualityprofiles/search?projectKey=JIQITONG
21:16:02.311 Downloading from http://192.168.2.81:9000/api/qualityprofiles/search?projectKey=JIQITONG
21:16:02.75 Fetching active rules for quality profile ‘AXWNL3IguiadNWSZv5U3’ from http://192.168.2.81:9000/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&activation=true&qprofile=AXWNL3IguiadNWSZv5U3&p=1
21:16:02.753 Downloading from http://192.168.2.81:9000/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&activation=true&qprofile=AXWNL3IguiadNWSZv5U3&p=1
21:16:03.205 Fetching rules not active in quality profile ‘AXWNL3IguiadNWSZv5U3’ for language ‘vbnet’ from http://192.168.2.81:9000/api/rules/search?f=internalKey&ps=500&activation=false&qprofile=AXWNL3IguiadNWSZv5U3&p=1&languages=vbnet
21:16:03.21 Downloading from http://192.168.2.81:9000/api/rules/search?f=internalKey&ps=500&activation=false&qprofile=AXWNL3IguiadNWSZv5U3&p=1&languages=vbnet
21:16:03.64 Local analyzer cache: C:\Users\lenovo\AppData\Local\Temp.sonarqube\resources
21:16:03.645 Writing Roslyn generated ruleset to D:\04-项目源码\济南市中小企业公共服务中心\Trunk.sonarqube\conf\SonarQubeRoslyn-vbnet.ruleset…
21:16:03.66 Writing Roslyn analyzer additional file to D:\04-项目源码\济南市中小企业公共服务中心\Trunk.sonarqube\conf\vbnet\SonarLint.xml…
21:16:03.663 Provisioning analyzer assemblies for vbnet…
21:16:03.664 Installing required Roslyn analyzers…
21:16:03.664 Processing plugin: vbnet version 7.15.0.8572
21:16:03.666 Cache hit: using plugin files from C:\Users\lenovo\AppData\Local\Temp.sonarqube\resources\3
21:16:03.688 Pre-processing succeeded.

Hello,

There’s apparently only the logs of the begin step attached, and it ends successfully.
I also noticed that on the first post you used the Scanner for MSbuild 4.10 and on the 2nd the Scanner for MSBuild 4.3.1. Is there a reason for that ?
Generally speaking you should always use the latest version of scanners (Scanner for MSBuild 4.10 in the current case). It’s the latest and greatest and is backward compatible.

So, unless you have a reason, still to the same scanner from 1 run to the other.
And please send me the logs of the 3 steps

  • MSBuild.SonarQube.Runner.exe begin …
  • MSBuild …
  • MSBuild.SonarQube.Runner.exe end

You may want to attach a zip to the thread rather than inline in the post, since the logs may be quite long.

Olivier

Hello,
I use two version of Scanner,and upload all logs.
you can read that is successfully,but same result.

I 'm going to try sonar-scanner-cli-4.5.0.2216-windows ,and hope it will succeed.

SonarQube_Log.zip (48.9 KB)

Hello,
No need to try the scanner-cli. When scanning a .Net project you must use the Scanner for MSBuild, and it’s strongly recommended to use consistently the latest version.

OK, and I have upload project analysis and uoload logs,please help me find out why I can’t upload the analysis log.

@OlivierK Hi,I want to ask for your help again.

The problem is not solved that using the Scanner for MSBuild but don’t upload report.

Hello,

Please send logs of the Scanner for MSBuild to investigate

I am Facing Same Issue. Please help…