0
votes

Hi I am trying to run a windows command from Jenkins but getting error as

Could not execute because the specified command or file was not found. Possible reasons for this include:

  • You misspelled a built-in dotnet command.
  • You intended to execute a .NET Core program, but dotnet-sonarscanner does not exist.
  • You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

I am running below command

dotnet sonarscanner begin /d:sonar.host.url=http://abcd.com:9000 /d:sonar.login=xyz /d:sonar.password=xyz /k:"sampleproject" /d:sonar.cs.opencover.reportsPaths="D:\JenkinsWorkspace\workspace\sampleproject\sampleAPI\sampleAPI_Test\coverage.opencover.xml"

above command is running successfully in command prompt, only issue with Jenkins

1

1 Answers

0
votes

I had a similar issue. Figured out that jenkins was not running as the same user as the sonarscanner was installed.

I went to the task manager -> services -> open services

And there go to properties of the jenkins service. Here go to the LogOn tab and select This account. Add the user and restart the service.