0

I cloned a repository from GIT.hub and I'm having a hard time building this project. Because it's a multi-target but it fails on net45, as shown below.

Dependencies List

I've searched and applied pretty much all solutions to install the .NET 4.5 and I can create projects in several frameworks, as the image below shows:

Installed Frameworks

But for some reason the net45 fails to load.

The pertinent configuration is as follows:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>net35;net40;net45;net46;netstandard2.0;netstandard2.1;netcoreapp2.0;netcoreapp3.0;net5.0;net6.0</TargetFrameworks>
  </PropertyGroup>
</Project>

I'm at my wit's end trying to solve this.

Edited to add:
In the comments, user123456 asked me what error message I was getting.
Well, here it is:

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
Paulo Santos
  • 11,285
  • 4
  • 39
  • 65
  • what error message are you getting ? – user123456 May 13 '23 at 02:46
  • Run the Visual Studio Installer from the Start menu. Modify > Individual Components > tick ".NET Framework 4.5 targeting pack". Do pause a bit at the point of it, 4.5 went out of support 7 years ago. The oldest relevant one is 4.6.2, due for the chopping block in 2027. – Hans Passant May 13 '23 at 07:57
  • @HansPassant -- Tried your solution. No luck. For some reason my VS2022 refuses to load .NET 4.5 – Paulo Santos May 16 '23 at 22:50

1 Answers1

0

What finally fixed for me was to install Visual Studio 2017, and select all the .NET Framework options, only those.

Paulo Santos
  • 11,285
  • 4
  • 39
  • 65