Solve the problem that the target framework .net framework4.7.1 cannot be found when using Visual Studio Enterprise 2022 for Unity game development

Solve the problem that the target framework .net framework4.7.1 cannot be found when using Visual Studio Enterprise 2022 for Unity game development

Software installation and use process

Use Visual Studio Installer to install Visual Studio Enterprise 2022, and check the Unity game development under the game during the installation.
insert image description here
In a single component, make sure to check
insert image description here
the installation location of the .NET Framework 4.7.1 target package, customize it to the F drive, log in with Visual Studio Enterprise 2022, set Visual Studio Enterprise 2022 in Unity and open the corresponding project file, prompting that the target framework was not found. net framework4.7.1.

Troubleshooting

After prompting that the target framework .net framework4.7.1 was not found, try option 2 to jump to the official website to download and install the development kit and Chinese package, and you can see the installed target framework in the system programs and functions. Restart and try again, but still prompts no Find the target framework .net framework4.7.1. After downloading and installing the framework development kit, target package, and language pack offline, the problem is still not resolved.

After opening Visual Studio Enterprise 2022 to create a new project and select the framework, I found that no version of the framework that had been installed before was detected, and began to wonder whether it was a problem with the framework installation path. Find the location of all the installed frameworks, and find that the frameworks are located in the C:\Program Files (x86)\Reference Assemblies\Microsoft directory. The Framework in this directory contains all the previously installed frameworks, including 4.7.1.
insert image description here
Randomly think of whether there will be a similar directory on the disk where Visual Studio Enterprise 2022 is installed. After checking, there is indeed any target framework installed before, but there are only 3.0 and 3.5 frameworks in this directory.
It is suspected that Visual Studio Enterprise 2022 may detect the frameworks that exist in this directory. So copy the Framework directory
under the C disk as a whole to the Program Files (x86)\Reference Assemblies\Microsoft directory on the disk where Visual Studio Enterprise 2022 is installed, and the problem is solved.

Solution summary

If the user has customized the installation path of Visual Studio Enterprise 2022 and installed it to a non-system disk, and the target framework has already been installed, it may be that the installation disk of Visual Studio Enterprise 2022 is inconsistent with the disk where .net framework4.7.1 is installed, and Visual Studio Enterprise 2022 The framework detection directory is located on its own disk, so the framework cannot be detected and the target framework is not found.
The framework is installed on the C drive by default. Copy the Framework folder under the C:\Program Files (x86)\Reference Assemblies\Microsoft directory of the C drive to the same directory on the drive where Visual Studio Enterprise 2022 is located, and open visual studio 2022 again to load normally The item is no longer prompted and the problem is resolved.
Subsequent use of Visual Studio Installer to install other frameworks can be used normally with the same operation.

Guess you like

Origin blog.csdn.net/weixin_43891232/article/details/129445478