Dotnet sonarscanner prompts "Specify the project file to use"

Please provide

  • Operating system: Macos
  • SonarQube for VS Code plugin version:
  • Programming language you’re coding in: C#
  • Is connected mode used:
    • SonarQube Cloud, SonarQube Server, or SonarQube Community Build? (if one of the latter two, which version?):

And a thorough description of the problem / question:

In the root directory of a Unity project, there is a .sln file and multiple .csproj files. When executing dotnet sonarscanner begin/end, even though the .sln file has been specified, it still prompts “Specify the project file to be used, because this path contains multiple project files”. However, there is no issue when running dotnet build.

Hi,

Welcome to the community!

I’ve moved this to the SonarQube on-prem category, since it seems you’re trying to run analysis outside of SonarQube for IDE.

Could you provide your logs, please?

Share the Scanner for .NET verbose logs

  • Add /d:"sonar.verbose=true" to the…
    • SonarScanner.MSBuild.exe or dotnet sonarscanner begin command to get more detailed logs
      • For example: SonarScanner.MSBuild.exe begin /k:"MyProject" /d:"sonar.verbose=true"
    • “SonarQubePrepare” or “SonarCloudPrepare” task’s extraProperties argument if you are using Azure DevOps
      • For example:
        - task: SonarCloudPrepare@3
            inputs:
              SonarCloud: 'sonarcloud'
              organization: 'foo'
              scannerMode: 'dotnet'
              projectKey: 'foo_sonar-scanning-someconsoleapp'
              projectName: 'sonar-scanning-someconsoleapp'
              extraProperties: |
                sonar.verbose=true
        
  • The important logs are in the END step (i.e. SonarQubeAnalyze / SonarCloudAnalyze / “Run Code Analysis”)

Share the msbuild detailed logs

MsBuild.exe /t:Rebuild /v:d

or

dotnet build -v:d

 
Thx
Ann