.netmultitargeting

How to fix net45 failing to load in a multi-targeted project?


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>

Edited

In the comments, user123456 asked me what error message I was getting. 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

Solution

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