MSBUILD : error MSB1008: Only one project can be specified. Switch: SonarScanner.MSBuild.exe

Hi All,

Whem I try to execute the below command I’m getting
MSBUILD : error MSB1008: Only one project can be specified.
Switch: SonarScanner.MSBuild.exe

“C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe” smapleBuild.sln /t:Rebuild /p:Configuration=Debug /p:PreferredToolArchitecture=x64 SonarScanner.MSBuild.exe end /d:sonar.login=xxxxxxxx

When I execute SonarScanner.MSBuild.exe end /d:sonar.login=xxxxxxxx separate build getting success. But I need pass this in single command Because when I execute it separate jenkins is not understaing post processing getting failed.

Could anyone please help me on this @OlivierK @mickaelcaro @Colin ? Thank you

Hello @SrinivasP,

A couple of things before we proceed on this.

  1. I would expect that you properly close open community threads before moving to the next. I had no news on We have one solution with .net and C++ projects, and dependencies between them. Is SonarQube supports this with SonarScanner.MSBuild.exe?
    I would appreciate your feedback on whether this was solved or not.

  2. When you report a problem like this thread, it’s a best practice to attach the full logs (scanner and build logs) of your analysis and not only the final error. If you only report the final error we are 95% blind to help you.

  3. Please refrain from summoning particular community members in your posts. Someone will have a lot at it at some point.

Olivier

  1. C++ errors are fixed and you can close the thread .

2.please find the log details below.
C:\Program Files (x86)\Jenkins\workspace\Test_Sonar@3>“C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe” sampleBuild.sln /t:Rebuild /p:Configuration=Debug /p:PreferredToolArchitecture=x64 SonarScanner.MSBuild.exe end /d:sonar.login=xxxxxx
Microsoft ® Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright © Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1008: Only one project can be specified.
Switch: SonarScanner.MSBuild.exe

For switch syntax, type “MSBuild /help”

C:\Program Files (x86)\Jenkins\workspace\Test_Sonar@3>exit 1
Build step ‘Execute Windows batch command’ marked build as failure

That’s an MSBuild error. You are passing the MSBuild command and “scanner end” command on the same line so MSBuild.exe thinks you are passing SonarScanner.MSBuild.exe as an parameter, which it doesn’t understand.

You need to configure Jenkins to run the commands separately. Have you looked at the docs?

When I followed the Doc and added the SonarQube for MSBuild - Begin Analysis and executed below windows batch command and getting the below errors.

C:\Program Files (x86)\Jenkins\workspace\Test_Sonar@3>“C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe” sampleBuild.sln /t:Rebuild /p:Configuration=Debug /p:PreferredToolArchitecture=x64

Errors:
(x86)\Jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\Pharmserv_Sonar\SonarQube.Analysis.xml 17:16:07 WARNING: Please specify the command ‘begin’ or ‘end’ to indicate whether pre- or post-processing is required. These parameters will become mandatory in a later release. 17:16:07 ERROR: Execution of SonarScanner for MSBuild failed (exit code 1)

Can I ask you please to post in the original thread to keep a minimum of consistency and organization

You’re stating that you run the SonarQube Scanner begin step (1st step) but you don’t show the command so I cannot be sure that you run it correctly. (The command you provide is the 2nd step, which is the MSBuild execution)

Can you please provide all the commands that you run in succession with the full output of each of them.

I found the solution and the issue fixed