Sonarscanner plugin in Jenkins for dotnetcore command not found

Hi,

Using
I am using sonarscanner plugin for analyzing aspnetcore 2.2 project in Jenkins pipeline

Environment

Withouth Docker Agent

  • I have used tool feature and also as variable in the pipeline to use the SonarScanner.MSBuild.dll downloaded when automatic installation in the Global Tool Configuration
  • dotnet-sdk-2.2 is installed in the local environment
  • While running the local command the dotnet sonarscanner in the env, dotnet sonarscanner is being recognized.
  • But fails to recognize in the pipeline

Fails in Pipeline

With Docker Agent

Docker Image – Official aspnetcore 2.2 image

  • Installed open-jre-8
  • Installed sonarscanner with dotnet tool in CLI
  • The path is also set for the .dotnet/tools
  • While running the local command the dotnet sonarscanner in the env, dotnet sonarscanner is being recognized.
  • But fails to recognize in the pipeline

Fails in Pipeline

The failure message in the pipeline has been consistant being

  1. dotnet sonarscanner not found
  2. dotnet-/var/lib/jenkins/tools/hudson.plugins.sonar.MsBuildSQRunnerInstallation/Sonar_Scanner_Net_Core_2.0/SonarSacanner.MSBuild.dll not found

When the dll and the tool is present.