I am new to SonarQube and would appreciate your help.
I am using sonarqube-8.9.10.61524 on my local Mac computer. I plan to run sonar scan using jenkins for my code. I have setup the tooling in my Jenkins and have set the path for MSBUILD_SQ_SCANNER_HOME as /Users/macintosh12/.jenkins/tools/hudson.plugins.sonar.MsBuildSQRunnerInstallation/SonarMSBuild
However when I try to run the scan, I receive this message: /Users/macintosh12/.jenkins/tools/hudson.plugins.sonar.MsBuildSQRunnerInstallation/SonarMSBuild/SonarScanner.MSBuild.exe: cannot execute binary file
This snippet is from one of the stages in my Jenkinsfile:
You aren’t going to be able to run a .exe on a Mac.
What language(s) are you trying to analyze?
Make sure you upgrade to SonarQube v9.9 LTS soon, not only to benefit from our Best LTS Ever™, but because soon we will systematically ask users to upgrade when they ask questions about earlier versions of SonarQube, which are now considered unsupported.
Apologies for the delay, I was able to solve the issue by adding mono at the beginning of my script, this was able to successfully scan my project. I am using MSBuild for a c# project.
In case someone is facing the same issue, here is my fix:
sh "mono ${sqScannerMsBuildHome}/SonarScanner.MSBuild.exe begin /k:project-Key /d:sonar.host.url=http://localhost:9000 /d:sonar.login=****** /d:sonar.password=******"