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 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?