Visual Studio 2022 cannot locate installed .net framework

Tiny Night 31 Reputation points

I have installed SDK and runtime for .net framework 4.8 in visual studio installer.

However, I cannot find the installed frameworks in visual studio 2022.

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.

.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,115 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tiny Night 31 Reputation points

    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.

    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.