build\.NETFramework\v4.5\ to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5For more details: Building a project that target .NET Framework 4.5 in Visual Studio 2022
For .NET 4.0, this command will install it for you if you have the Visual Studio 2019 files cached:
msiexec.exe /i "%ALLUSERSPROFILE%\Microsoft\VisualStudio\Packages\Microsoft.Net.4.TargetingPack,version=4.0.30319.1\netfx_dtp.msi" EXTUI=1
For .NET 4.5, this might work, though I haven't tried it:
msiexec.exe /i "%ALLUSERSPROFILE%\Microsoft\VisualStudio\Packages\Microsoft.Net.4.5.2.TargetingPack,version=4.5.51651.1\netfx_452mtpack.msi" EXTUI=1