0

I'm getting below error on windows agent while beginning the Sonarqube scanner.

MSBuild.SonarQube.Runner.exe : The term 'MSBuild.SonarQube.Runner.exe' is not recognized as the name of a cmdlet, 
function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the 
path is correct and try again.

Below is the command I have used inside my workflow.

- name: Build and analyze
      env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  
      shell: powershell
      run: |
          MSBuild.SonarQube.Runner.exe begin /k:"${{ env.PROJECT_KEY }}" /v:"${{ env.YEAR }}.${{ env.PERIOD }}.${{ env.REVISION }}.${{ github.run_number }}" /n:${{ env.PROJECT_NAME }} /d:sonar.host.url=${{ env.SONARQUBE_HOST_URL }} /d:sonar.login=${{ secrets.SONAR_TOKEN }}  /d:sonar.verbose="false"
          msbuild ProjectName.sln /p:SkipInvalidConfigurations=true /p:TrackFileAccess=false /p:Configuration=Release /p:Platform="x86"
          MSBuild.SonarQube.Runner.exe end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"

Does anyone have idea how to resolve this? Please help.

Pedram
  • 6,256
  • 10
  • 65
  • 87
  • Make sure that the exe's folder is part of the PATH variable or specify the full path? – riQQ Jul 07 '21 at 06:51
  • @riQQ - Sorry but I am new to this and I don't know how to get the full path for this exe on agent. Do you know how can I get it? And yes I have not installed anything to windows agent for SonarQube scan - so might be I need to do that or it's not required? I simply tried this - https://github.com/SonarSource/sonar-.net-documentation/blob/master/doc/analyze-from-the-command-line.md – Pedram Jul 07 '21 at 06:56
  • 1
    You need to run the steps that prepare SonarQube. Please refer to [documentation](https://docs.sonarqube.org/latest/analysis/azuredevops-integration/). – raspy Jul 07 '21 at 07:36
  • Did you try it with the call operator `& MSBuild.SonarQube.Runner.exe ...`? – milbrandt Jul 31 '21 at 13:14

0 Answers0