When trying to build a Gen .NET C# application with Visual Studio 2022 you will receive:
error MSB3644: The reference assemblies for .NETFramework,Version=v4.0 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/
Gen Build Tool using Visual Studio 2022.
Visual Studio 2022 no longer delivers .NET Framework 4.0. Building Gen generated C# code will result in the above error regardless of the value used for Build Tool OPTIONS token OPT.VSVERSION.
There is currently no resolution.
Workaround:
If you intend to build C# applications with a Visual Studio 2022 installation, you will need to install the following individual component from the Visual Studio 2019 installation: