Analyze mixed versions of .NET

  • which versions are you using

    • SonarQube
      • 8.5 Community
    • Scanner
      • sonar-scanner-msbuild-
      • sonar-scanner-msbuild-
  • what are you trying to achieve
    In a single git repository we have two .NET 5 solutions and one .NET 4.7.2 solution and one .NETStandard 2.0 solution. The .NETStandard project is referenced by all other .NET projects (.NET 5 & .NET 4.7.2)

        /Common Solution
    		/Common.csproj (NetStandard 2.0)
       /Solution1 (.NET 5)
            All projects are .NET5 
            References Common.csproj
      /Solution2 (.NET 5)
    	    All projects are .NET5 
          References Common.csproj
     /Solution3 (.NET Framework 4.7.2)
    	    All projects are 4.7.2 
          References Common.csproj

I understand that .Net 4.7.2 and .Net 5 have different scanners. I would like to know, If I analyze solutions using their respective scanners but point both scanners to the same SonarQube project using same project key in both scanners, will it work? or will the second scans overwrite the result of the first scan?

--Scan NET 5 solutions
dotnet "C:\SonarQubeScanners\net5\SonarScanner.MSBuild.dll" begin /k:"MyProjectKey" /"" /d:sonar.login="myloginkey"
dotnet build Solution1.sln"
dotnet build Solution2.sln"
dotnet "C:\SonarQubeScanners\net5\SonarScanner.MSBuild.dll" end /d:sonar.login="myloginkey"

--Scan NET 4.7.2 solution
C:\SonarQubeScanners\net46\SonarScanner.MSBuild.exe begin /k:"MyProjectKey" /"" /d:sonar.login="myloginkey"
"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe" "Solution3.sln" /t:Rebuild /p:Configuration=Release 
C:\SonarQubeScanners\net46\SonarScanner.MSBuild.exe end /d:sonar.login="myloginkey"

I am trying to avoid creating two separate SonarQube projects, One for .NET 5 solutions and Second for .NET 4.7.2 Solution.