Visual Studio 2022 cannot locate installed .net framework

Tiny Night 31 Reputation points
2022-02-12T17:45:36.513+00:00

I have installed SDK and runtime for .net framework 4.8 in visual studio installer.
173720-image.png

However, I cannot find the installed frameworks in visual studio 2022.
173821-1.png

I have checked my VS 2019 and it can locate net framework 4.8 well, and it can build my project. But VS 2022 cannot.
I have re-installed VS 2022 and VS 2019 but VS 2022 still cannot locate my frameworks but VS 2019 can.
I have checked in regedit and it has infomation about .net framework 4.8.
173822-2.png

.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,126 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tiny Night 31 Reputation points
    2022-02-12T18:09:57.753+00:00

    It seems that VS2019 is locating .net framework from hard coded path "C:\Program Files (x86)\Reference Assemblies", but VS 2022 is locating them under "ProgramFilesDir (x86)" in regedit.
    I have modified the value of "ProgramFilesDir (x86)" to manage my apps. But .net framework it is still placed under the hard coded location so that VS 2019 can find them but VS 2022 cannot. After copied "Reference Assemblies" to my custom path, VS 2022 works well.
    173812-3.png

    This question can be closed.
    It will be good if VS installer and VS 2019 could take care of the path of Program Files.

    4 people found this answer helpful.