'Visual Studio 2022 does not find reference assemblies for >NETframework Version 4.0

Trying to compile Python Django project but receiving build error:

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(1217,5): 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/developerpacks Done building project "myFinancialTracker.pyproj" -- FAILED.

How can I resolve?



Solution 1:[1]

I also got the same error as you, this is because VS 2022 doesn't come with .net framework 4.0 option during installation, to overcome this problem I install VS 2019 and enable the usage of .net-framework 4.0 during installation. After the installation, I tried to run my project again using VS2022 and the error goes away.

I tried to download and install .net-framework 4.0 separately but Microsoft doesn't allow me to do so, to overcome this, I install VS2019 instead.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Maidenless Runt