SonarScanner.MSBuild.exe is not recognized as an inter or external command

I downloaded and unzipped the community edition from Download | SonarQube, following instructions on SonarScanner for .NET | SonarQube Docs.

I was able to get sonarcube running on port 9000, but when I execute the command “SonarScanner.MSBuild.exe . . .”, it is not recognized. I can run MSBuild /t:Rebuild though, but nothing shows up on the dashboard.

I tried some other stuff, no joy. I’ve seen similar posts but nothing The environment is isolated (no web connection), using visual studio and .Net 4.6. Please advise.

Hi,

Welcome to the community!

There are multiple pieces to getting started with SonarQube. The first is setting up the server, which it looks like you’ve done. And then there’s getting going with analysis.

Ideally this will happen on a different machine than the one hosting your SonarQube server. Usually this is a CI build agent. And on that build agent - or wherever you build and analyze your project, you’re going to need to install the scanner. That’s actually the error you’re getting; that the scanner isn’t installed. The docs should get you started.

 
HTH,
Ann

CLASSIFICATION: UNCLASSIFIED

Hi. Thanks for the quick response.

I’ve been through this document.

Prerequisites:

I’m using Visual Studio 2022 (and have installed build tools). Do I need to go back to 2017?

Regards,

Andrew Berresford

Computer Scientist

CSLA, CSD-CRB

Information Systems Security Program (ISSP)

Commercial: (520) 538-7568 / DSN: 879-7568

CUI

image004.jpg

Hi Andrew,

Did you do the download at the top of it? That’s what you would install on your build agent to deal with the error you’re seeing.

 
Ann

CLASSIFICATION: UNCLASSIFIED

That’s probably the issue. The firewall will not let me at that link, it redirects to (objects.githubusercontent.com)

I downloaded from the sonarqube.org website, obviously not the same.

Regards,

Andrew Berresford

Computer Scientist

CSLA, CSD-CRB

Information Systems Security Program (ISSP)

Commercial: (520) 538-7568 / DSN: 879-7568

CUI

image004.jpg

image002.jpg

Hi @andrewvbe,

you need to download the scanner tool, otherwise, you will not be able to execute the analysis.

Is NuGet.org also blocked? One other way would be to download dotnet-sonarscanner tool and run the analysis with the following:

dotnet tool install --global dotnet-sonarscanner
dotnet sonarscanner begin /k:"project-key" /d:sonar.login="<token>"
dotnet build <path to solution.sln>
dotnet sonarscanner end /d:sonar.login="<token>"

as described in the documentation: SonarScanner for .NET | SonarQube Docs

This topic was automatically closed after 10 days. New replies are no longer allowed.