Sonar Scanner failing with more than one project descriptor (sln and csproj)

  • Repo: Azure DevOps
  • CI system: TeamCity, PowerShell script
  • Scanner: dotnet sonarscanner (SonarScanner for MSBuild 8.0.2)
  • .NET

Hi there!

A customer of us has this .NET repository and they have at the root of the project a .sln and a .csproj for one of the modules.

I cannot do any modifications to the repo and I have to analyze it. Sonar is giving this message:

'Specify which project file to use because this xxxxxxx(working directory) contains more than one project.‘

I have checked the docs and we do not have any parameter in order to specify which file is the project descriptor.

How do I proceed?

Regards,

Hey there.

This is a known issue – SCAN4NET-604

As noted in the ticket:

Known workarounds

Use SonarScanner.MSBuild.exe or dotnet sonarscanner.msbuild.dll to run the begin step, OR Create a solution that references the projects and build the solution.

Hi, Colin:

Thank you for the quick response.

As per the ticket I understand this is a problem with MsBuild and not Sonar Scanner itself, so we can’t expect to have this fixed for a while. Am I right?

yeah, unfortunately given that invoke a dotnet tool with multiple *proj in same directory is not possibile · Issue #7226 · dotnet/sdk · GitHub has been open since 2016 (!) I wouldn’t hold my breath.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.