Are you using SonarScanner for .NET ?
The Scanner for MSBuild will analyze files only if they’re referenced in the csproj , see Analysing repo with multiple project types (.net core / typescript) - #2 by mickaelcaro
Also see Problems with test execution and coverage upload - #6