Visual Studio2019 changes and downloads the .Net Framework target framework

1. Problems

When using .net for development, the developed project will be very closely related to the .net framework target framework, so when the .net framework used locally by vs is inconsistent with the framework of the project project, the current project may not be opened. Ways to solve this problem are:

  • The first one: to change the target framework to adapt to the current VS;
  • The second method: or install the corresponding version framework in vs according to the target framework; [recommended]

If you choose the first method, replace the target framework used by the project with the one currently used by VS, and then develop, it may cause code errors due to the different target frameworks, and what's more: after the change, it will be different from other people's original target frameworks. When the developed code is merged, there are more errors. Therefore, from the perspective of software development and project debugging, the effect of using the second method is better, at least it only increases the installation steps.

Click Project --> Properties --> to view or select the target framework for the application. The .Net Framework target contains multiple .net frameworks

 

Attached is the development package for downloading and installing the .net framework.

Development package download link: .NET SDKs downloads for Visual Studio

Select Developer Pack  and click Download. After downloading the development package, double-click to install it.

 

2. Download and change the .Net Framework target framework

1. After entering the VS main interface, click Tools -> Get Tools and Functions, and then the Visual Studio Installer interface will pop up (if you have already used it, you will be directly transferred to the third step interface):

 2. In the pop-up Visual Studio Installer, select the VS version you want to change, click Modify, and the modification window will pop up, as follows:

 3. Follow the instructions in the picture and complete the installation according to the required target framework, as follows:

 Note: When changing the installation, VS needs to be closed, so if you open the project code in VS, please save it first, and exit VS first;

 Create a .NET Standard class library

Select "Class Library" to create a .NET or .NET Standard-oriented class library project. Note: Do not select "Class Library (.NET Framework)"

Guess you like

Origin blog.csdn.net/zgscwxd/article/details/131489195
Recommended