.NET Core 2.0 .dll not found by sonarscanner for msbuild

Pipeline

node {
stage(‘SCM’) {
git ‘https://github.com/apurvakhatri/WebApplication1.git
}
stage(‘restore’){
bat ’ “C:\nuget.commandline.4.3.0\tools\NuGet.exe” restore " “C:\source\repos\WebApplication1\WebApplication1.sln” " ’
}

stage(‘analysis’){
def sqScannerMsBuildHome = tool ‘CoreMSBuildSonar1’

    withSonarQubeEnv(credentialsId: 'SonarQubeServer') {
        bat "${sqScannerMsBuildHome}\\SonarScanner.MSBuild.dll begin /k:\"apurvasonar\" /n:\"apurva-sonar\"  /d:sonar.verbose=true "
        echo "Begin worked"
        
        bat  ' "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe" \"C:\\source\\repos\\WebApplication1\\WebApplication1.sln\" '
        echo "Built successful" 
        
        bat "${sqScannerMsBuildHome}\\SonarScanner.MSBuild.dll end"
        echo "safely ended"
    }

}
}

SonarScanner for MSBuild Global configuration settings:

SonarQube Server:

The error which i get at the begin step

C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins.jenkins\workspace\SonarTry@2>C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\CoreMSBuildSonar1\SonarScanner.MSBuild.dll begin /k:“apurvasonar” /n:“apurva-sonar” /d:sonar.verbose=true

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.

Whereas the dir struct of sonarqube scanner for msbuild is:
sonarqube dir

Any Solution how I should approach? Please help!

Hello @Apurva_Khatri and welcome to our community.

Can you please verify that .NET Core Runtime 2.1 is installed on your build machine? .NET Core itself is not shipped with the scanner binaries.

You can download installation from Microsoft site