.NET Framework version issue after installing required & suggested framework

Please provide

  • Operating system: Windows 10
  • Programming language you’re coding in: .NET
  • Is connected mode used: SonarQube (Developer Edition)

After executing 2nd command to analyze the code as ‘MsBuild.exe /t:Rebuild’, the below .NET Framework version issue is coming. And also tried to install suggested framework version 4.5.1 also as 4.5 version is not available, but still it is showing same issue as below.

*Microsoft (R) Build Engine version 17.2.1+52cd2da31 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the “-m” switch.
Build started 10/31/2022 9:47:02 AM.
Project “D:.… .sln” on node 1 (Rebuild target(s)). ValidateSolutionConfiguration: Building solution configuration “Debug|Any CPU”.
Project “D:… .sln” (1) is building “D:… .csproj” (2) on node 1 (Rebuild target(s)).
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersio n.targets(1221,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.5 were not found. To resolve th is, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can do wnload .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [D:… .csproj]
Done Building Project “D:…csproj” (Rebuild target(s)) – FAILED.

Done Building Project “D:… .sln” (Rebuild target(s)) – FAILED.

Build FAILED.

“D:… .sln” (R ebuild target) (1) →
“D:… .csproj” (Rebuild target) (2) →
(GetReferenceAssemblyPaths target) →
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVers ion.targets(1221,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.5 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [D:… .csproj] *

*0 Warning(s) *
1 Error(s)

Please help me out, to solve this issue.

Thanks,
Sushma

Hey there.

Is MsBuild.exe /t:Rebuild working correctly when SonarQube is not in the picture (when you don’t run the first step?)

Hi Colin,

I have run 1st step to begin, later only executing this MsBuild.exe /t:Rebuild command.

Thanks,
Sushma

And, does MsBuild.exe /t:Rebuild work when you don’t run the begin step at all?

Yes, it is running and showing same issue about framework version again. And as suggested i have installed 4.5.1 framework version as 4.5V is not available, but then also it is showing issue as below.

Thanks,
Sushma

If you’re facing an issue running MsBuild.exe /t:Rebuild when the scanner is not involved, there’s not much help we can provide. You should work on having a successful compilation of your code, and then add in the SonarQube analysis.