Search code examples
sonarqube

Unable to run dotnet sonarscanner begin /k:"project-key" /d:sonar.login="<token>"


Following SonarScanner for .NET documentation, I have already installed SonarScanner / SonarQube locally and I can start the service at http://localhost:9000/

I have also run this command: dotnet tool install --global dotnet-sonarscanner

But when I run dotnet sonarscanner begin /k:"Project_Scan_1", I got this error

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 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.

Solution

  • After running the command prompt as administrator, I could run the command.