SonarSource/sonar-scanner-msbuild

Project key and organization should be read from settings file

andrei-epure-sonarsource opened this issue · 3 comments

According to our documentation:

Begin step command line parameters
/k:
[required] Specifies the key of the analyzed project in SonarCloud.
/o:
[required] Specifies the name of the target organization in SonarCloud.

However, the error messages when not providing them suggest that these commands can alternatively be passed via a settings file.

In this community post the user is confused by the error message:

Using environment variables to determine the download directory...
18:19:45.118  Expecting at least the following command line argument:
- SonarQube/SonarCloud project key
The full path to a settings file can also be supplied. If it is not supplied, the exe will attempt to locate a default settings file in the same directory as the SonarQube Scanner for MSBuild.
Use '/?' or '/h' to see the help message.
18:19:45.119  Pre-processing failed. Exit code: 1

The error message suggests the project key can be passed in a settings file, but this is wrong. The project key is currently a required command line parameter, together with the organization. So even if users provide a settings file via an /s parameter, the analysis will fail.

Ideally we should allow these settings to be passed from the settings file.

If this is not immediately possible because of some technical debt, we should update the error message ASAP to be less confusing.

There's ongoing discussion with Analysis Experience squad about aligning the parameter-file experience across different scanner flavors.
https://sonarsource.slack.com/archives/C03HVJQ53M2/p1729695232547249

The decision from that effort will impact the result for this issue.

Is the attached Slack link publicly accessible? Or was it added to the issue for internal use?

The slack link is internal, just to keep the issue updated.