Someone needs to update the documentation on that page to properly represent the commands to run. \ is not a line continuation character for any native windows cli, but that shouldn’t even be necessary to specify.
PS> SonarScanner.MSBuild.exe begin /o:"MyOrgName" /k:"MyProject" /d:sonar.host.url="https://sonarcloud.io"
<it reports about 10 lines of output>
PS> msbuild.exe .\My.sln /t:Clean,Build
<the usual build log output>
PS> SonarScanner.MSBuild.exe end
That is the correct syntax for powershell for this command using msbuild.exe. Substitute dotnet build if you like typing more (or want to be trendy)
Even after that I get
ERROR: JAVA_HOME not found in your environment, and no Java
executable present in the PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation, or add "java.exe" to the PATH
But I’m running a scan for .net, not Java. Is Java a prereq? I dont see it on the sonarscanner install page and would love to avoid installing that and getting the constant “update me now” notifications if possible.
Thanks, I installed 15 and its working for that. I went back to the page in the title and then to the link it has for “SonarScanner installation instructions” (.net, windows, msbuild), and scrolled down the entire page not seeing anything about prereqs.
Then I realized the link had dumped me to an anchor on the page after the prereqs.
So to recap, the Windows directions are vague WRT “bin” folder (it means the directory where the sonar scanner’s exe is). The examples are written for Bash (i think), and the configure analysis page links to a section later than when it probably should.