Hi all,
I am trying to use SonarScanner to build and send my results to a remote SonarQube server however I am having issues completing the process.
On the documents for SonarScanner for .NET there are 2 options:
SonarScanner.MSBuild.exe begin /k:"project-key" /d:sonar.login="<token>"
MSBuild.exe <path to solution.sln> /t:Rebuild
SonarScanner.MSBuild.exe end /d:sonar.login="<token>"
and
dotnet <path to SonarScanner.MSBuild.dll> begin /k:"project-key" /d:sonar.login="<token>"
dotnet build <path to solution.sln>
dotnet <path to SonarScanner.MSBuild.dll> end /d:sonar.login="<token>"
However for [sonar-scanner-msbuild-5.2.1.31210-net5.0] there is no MSBuild.exe and thus I am using a combination of the both options to build my program. Testing with a simple C# Hello World program only. My command for starting and ending is as below:
dotnet "...\Desktop\dotnetInstallers\sonar-scanner-msbuild-5.2.1.31210-net5.0\SonarScanner.MSBuild.dll" begin /k:"testing1" /d:sonar.verbose=true
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\msbuild.exe" /t:Rebuild "...\source\repos\TestHelloWorld\TestHelloWorld.sln"
dotnet "...\Desktop\dotnetInstallers\sonar-scanner-msbuild-5.2.1.31210-net5.0\SonarScanner.MSBuild.dll" end
The Begin and Build process completes without any errors however the End process throws an error below:
SonarScanner for MSBuild 5.2.1
Using the .NET Core version of the Scanner for MSBuild
Post-processing started.
09:23:48.739 09:23:48.739 sonar.verbose=true was specified - setting the log verbosity to 'Debug'
09:23:48.74 Loading the SonarQube analysis config from C:\WINDOWS\system32\.sonarqube\conf\SonarQubeAnalysisConfig.xml
09:23:48.741 Not running under TeamBuild
09:23:48.741 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\conf\SonarQubeAnalysisConfig.xml
09:23:48.743 Generating SonarQube project properties file to C:\WINDOWS\system32\.sonarqube\out\sonar-project.properties
09:23:48.747 Generation of the sonar-properties file failed. Unable to complete the analysis.
09:23:48.75 Writing processing summary to C:\WINDOWS\system32\.sonarqube\out\ProjectInfo.log
09:23:48.746 The SonarScanner for 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)
09:23:48.752 Post-processing failed. Exit code: 1
Any idea what I can do to get this running?
Versions List:
- SonarQube : Developer Edition 8.5.1 Build(38104)
- SonarScanner : sonar-scanner-msbuild-5.2.1.31210-net5.0
- MSBuild : MSBuild 16.0 C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\msbuild.exe