Skip to content

Instantly share code, notes, and snippets.

@vlOd2
Last active June 21, 2024 12:46
Show Gist options
  • Save vlOd2/1c3c15ac559c30b90cde709d84b39e60 to your computer and use it in GitHub Desktop.
Save vlOd2/1c3c15ac559c30b90cde709d84b39e60 to your computer and use it in GitHub Desktop.
Install .NET Framework 4.0 and 4.5 on VS 2022
This guide explains how to install .NET Framework 4.0 and 4.5 on VS 2022, as it doesn't support these versions out of the box.
Microsoft says these versions are outdated but many people still need them to maintain legacy apps.
Requirements:
- VS 2022
- 7-zip (I haven't tested WinRar)
Notes:
- When .NET 4.0 is mentioned, it means .NET Framework 4.0
- When it's mentioned to open as an archive or un-zip, use 7-zip
The steps:
1. Download the .NET 4.0 Reference Assemblies from https://www.nuget.org/api/v2/package/Microsoft.NETFramework.ReferenceAssemblies.net40/1.0.3
2. Once downloaded, open them up as an archive
3. Navigate to Build > .NETFramework
4. Keep 7-zip open and open the folder C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework
5. Delete the existing v4.0 (or make a backup)
6. Extract the v4.0 folder from 7-zip into the folder (make sure to not extract the contents but the folder itself)
7. Open Visual Studio 2022 and now you should see .NET 4.0 as a .NET Framework target
For .NET Framework 4.5/4.5.1/4.5.2:
- Do the same steps as mentioned above but use the appropriate Reference Assemblies (listed bellow) and folder
.NET 4.5:
https://www.nuget.org/api/v2/package/Microsoft.NETFramework.ReferenceAssemblies.net45/1.0.3
.NET 4.5.1:
https://www.nuget.org/api/v2/package/Microsoft.NETFramework.ReferenceAssemblies.net451/1.0.3
.NET 4.5.2:
https://www.nuget.org/api/v2/package/Microsoft.NETFramework.ReferenceAssemblies.net452/1.0.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment