Building a project that target .NET Framework 4.5 in Visual Studio 2022

Error MSB3644: The reference assemblies for framework “.NETFramework,Version=v4.5” were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed

For some reason, the oldest version of .NET Framework for which a developer pack is available is 4.5.1.
I could just retarget my libraries to .NET Framework 4.5.1, but I just don’t want to.

There is no developer pack for .NET Framework 4.5

Luckily, there is an easy solution!

1) Extract the .nupkg from Microsoft.NETFramework.ReferenceAssemblies.net45 NuGet package.
2) Then, copy the files from that package build\.NETFramework\v4.5\ to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5

That’s it!
Visual Studio can now build projects that target .NET Framework 4.5.
I hope this helps someone, because I couldn’t find any useful information about this on the web!

Leave a comment

Your email address will not be published. Required fields are marked *