Hi,
SonarQube on-prem version 7.9 (sonarqube is running in as a docker container)
SonarQube Scanner for Jenkins plugin version 2.13.1
I am trying to do the sonarqube analysis for a .Net Core 3.1 project through a jenkins pipeline. I am building the code on jekins server (Windows server 2012 R2) and then uploading analysis on sonar server using opencover.
When .Net Core 2.x SDK is installed on my jenkins server the analysis works fine with SonarScanner for MSBuild 5.2.2 - .NET Core 2.0.
But as 2.X core version is going to be EOL(out of support) soon, we have uninstalled it and now we have .Net core version 3.1 and above installed on the jenkins server and we have selected SonarScanner for MSBuild 5.2.2 - .NET Core 3.0 from the global tool configuration.
But now the sonarqube analysis fails and we get the below error:
###########################################################################
E:\workspace\test-dotnet31-59>dotnet âE:\Program Files (x86)\Jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\SonarQube_for_MSBuild_Core\SonarScanner.MSBuild.dllâ begin /k:âTest_dotnetcore31_iisâ /n:âTest_dotnetcore31_iisâ /v:â1.0â /d:sonar.cs.opencover.reportsPaths=âE:\workspace\test-dotnet31-59\opencover.xmlâ /d:sonar.host.url=http://sonarqube.org-name.com:9002
SonarScanner for MSBuild 5.2.2
Using the .NET Core version of the Scanner for MSBuild
Pre-processing started.
Preparing working directoriesâŠ
09:34:22.525 Updating build integration targetsâŠ
09:34:22.872 Failed to request and parse âhttp://sonarqube.org-name:9002/api/server/versionâ: Object reference not set to an instance of an object.
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at SonarScanner.MSBuild.PreProcessor.SonarWebService.<>c__DisplayClass18_0.<b__0>d.MoveNext()
â End of stack trace from previous location where exception was thrown â
at SonarScanner.MSBuild.PreProcessor.SonarWebService.DoLogExceptions[T](Func`1 op, String url)
at SonarScanner.MSBuild.PreProcessor.SonarWebService.DownloadServerVersion()
at SonarScanner.MSBuild.PreProcessor.SonarWebService.GetServerVersion()
at SonarScanner.MSBuild.PreProcessor.SonarWebService.WarnIfSonarQubeVersionIsDeprecated()
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs localSettings)
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.Execute(String args)
at SonarScanner.MSBuild.BootstrapperClass.PreProcess()
at SonarScanner.MSBuild.BootstrapperClass.Execute()
at SonarScanner.MSBuild.Program.Execute(String args, ILogger logger)
at SonarScanner.MSBuild.Program.Execute(String args)
at SonarScanner.MSBuild.Program.Main(String args)
at SonarScanner.MSBuild.Program.(String args)
###########################################################################
We are able to access âhttp://sonarqube.org-name:9002/api/server/versionâ as well.
The Sonarqube version we are using is 7.9.6.41879
So for running Sonar Scanner for Jenkins is it mandatory to have .Net Core 2.X installed on the jenkins server?
We are analysing the Net Core 3.1 project. (SonarScanner for MSBuild 5.2.2 - .NET Core 3.0 and .Net Core 2.x is not installed on jenkins server, only 3.1 core sdk and .Net 5.0 sdk)
Same error occurs for .Net 5.0 project. (SonarScanner for MSBuild 5.2.2 - .NET 5.0 and .Net Core 2.x is not installed on jenkins server, only 3.1 core sdk and .Net 5.0 sdk)