Shared C# project analysis ignored after update

I recently upgraded my SonarScanner for MSBuild from version 5.5.3 to 5.14 and encountered an issue where shared projects are no longer included in the analysis process. This results in numerous warning messages similar to the following:

WARN: File 'C:\path_to_shared_project\file.cs' referenced by the protobuf 'MetricsInfo' does not exist in the analysis context

I’m curious to know if shared projects are intentionally excluded from analysis in this version and how I can re-enable their inclusion in the analysis process. Any guidance on resolving this issue would be greatly appreciated.

I’m investigating the same issue. Reading, the thread below I thought adding, /p:SonarQubeExclude=false, would help. But, no luck.

SonarCloud test inclusions causes source exclusions"

Hey there.

I’m surprised to hear that upgrading the scanner caused a change in what files are being analyzed.

  • What version of SonarQube are you using? Is there any chance that changed as well?
  • If you switch back to v5.5.3 of the scanner, are those files being analyzed again?

I found the problem based on this log message:
14:02:25.084 14:02:25.084 WARNING: File 'c:\path_to_ws\Utility\Constant.cs' is not located under the base directory 'c:\path_to_ws\test\src\CommonTest' and will not be analyzed.

Adding /d:sonar.projectBaseDir=.. to SonarScanner fixed the problem.

Is there a reason why the code needs to be in the base directory?
Is there a way to disable this behavior?