Skip to content

Align error message for missing project key with error message for missing organization, when the settings file is provided #2120

Closed
@andrei-epure-sonarsource

Description

If I run

 dotnet-sonarscanner "begin" "/s:C:\workspace\external\net8-console\SonarQube.Analysis.xml" "/d:sonar.token=foo"

and the file contains:

<?xml version="1.0" encoding="utf-8" ?>
<SonarQubeAnalysisProperties
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://www.sonarsource.com/msbuild/integration/2015/1">
  <Property Name="sonar.verbose">true</Property>
  <Property Name="sonar.host.url">https://sonarcloud.io</Property>
  <Property Name="sonar.projectKey">myorg_myproj</Property>
  <Property Name="sonar.organization">myorg</Property>
  <Property Name="sonar.projectName">MYPROJ</Property>
</SonarQubeAnalysisProperties>

I get the following error when not passing the /k command line argument:

07:59:34.867 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.

And if I pass /k via command line but don't pass /o, the error message is:

sonar.organization parameter has been detected in the provided SonarQube.Analysis.xml config file. Please pass it in the command line instead, using /o: flag.

This is confusing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions