Visual Studio 2022 installs .NET Framework4.5 and below target packages

Visual Studio 2022 no longer supports .NET4.5. If you open a .Net4.8 target package or a .NET version project below .NET 4.8, you will be prompted that it is no longer supported.
insert image description here
I can't find an option for .NET4.5 and below even in the Visual Studio Installer.
insert image description here
So go to the official website to download .Net 4.5? Sorry, prompt during installation: The same or higher version of .NET Framework4.5 is already installed on this computer. As shown below
insert image description here
, is there any other way? The following will introduce in detail:

1. Install a previous version of Visual Studio, such as Visual Studio 2019.

2. Install through NuGet: Open the download page of NuGet's NET Framework 4.5, click the Download packagelink on the right to download the target framework.
insert image description here
The downloaded package is in .nupkg format, here change its extension to .zip, and then use the decompression software unzip.

\build\.NETFrameworkCopy the folder v4.0or v4.5folder in the unzipped directory to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFrameworkthe directory and
insert image description here
restart Visual Studio 2022

3. Use PM to download and install: Open the package manager console and enter:

NuGet\Install-Package Microsoft.NETFramework.ReferenceAssemblies.net45 -Version 1.0.3

and find the download directory.
insert image description here

Enter the Microsoft.NETFramework.ReferenceAssemblies.net45.1.0.2\build\ .NETFramework\v4.5 directory under this directory
insert image description here

Copy all the files in this directory to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\4.5the directory

insert image description here
Restart Visual Studio 2022

Guess you like

Origin blog.csdn.net/sd2208464/article/details/129539381