Visual Studio can't locate installer or .NET Framework, Windows can't locate Visual Studio installer

Gil Sharon 0 Reputation points
2025-01-01T03:15:37.8733333+00:00

I was referred here from the casual Microsoft forum: https://answers.microsoft.com/en-us/windows/forum/windows_11-hardware/visual-studio-cant-locate-installer-or-net/af4406ec-88ea-4acf-beed-27e0428ba347?messageId=6d100f88-fc38-4f8a-8f45-a17e52d81f81

So I'm trying to work on a new project in Unity and using Visual Studio as my code editor. When opening Visual Studio through double-clicking a script in Unity, I get the error "Target framework not installed": The C# project Assembly-CSharp targets a version of .NET Framework that is not installed. While you can change your target framework at any time, for stability and security we recommend that you move to a recent supported release.

This is already weird since the project is configured to use .NET Framework 4.8, but it suggests updating the target to .NET Framework 4.8, or to download version 4.7.1, either way both of these frameworks were installed through the Visual Vtudio installer.

I've tried both options and both lead to Visual Studio opening with "Assembly-CSharp (load failed)" appearing in the solution explorer. If I try to right click the project and choosing "Reload Project", I once again get the error "Target framework not installed" with the same description, except now it suggests downloading .NET Framework 4.8, which again, is already installed both manually and through the Visual Studio Installer.

At this point I wondered if Visual Studio was connected to the installer, and sure enough going to Tools -> Get Tools and Features... results in the error "Unable to locate Visual Studio Installer".

So there's now two installations that Visual Studio won't detect, but I can detect manually and verify that the files exist in the place where I expect them to.

Finally I went to Apps & Features in the windows 11 start menu, and it seems that the problem stems from windows itself not being able to find installations, as when I click Visual Studio Community 2022 -> modify, I get the error "Windows cannot find 'D:\Microsoft Visual Studio\Installer\setup.exe'. The installer itself is installed in drive C:, so I suspect the problem might be that both Windows and Visual Studio are looking for programs in the wrong drive.

How can I resolve these issues? Would changing where Windows looks for programs help? If so, how can I do that?

.NET
.NET
Microsoft Technologies based on the .NET software framework.
4,019 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,319 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
10,330 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 30,476 Reputation points Microsoft Vendor
    2025-01-01T05:12:14.9933333+00:00

    Hi @Gil Sharon, 

    Welcome to Microsoft Q&A! 

    Could you find the Visual Studio Installer folder: C:\Program Files (x86)\Microsoft Visual Studio\Installer

    If you can find it, please run the following command line in Command Prompt to repair your VS:

    "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installershell.exe" repair --installPath="C:\Program Files\Microsoft Visual Studio\2022\Community" 

    If it doesn’t work, please remove the Visual Studio Installer folder: C:\Program Files (x86)\Microsoft Visual Studio\Installer. Then, re-download the bootstrapper file from the following Microsoft Site and run it as administrator.

    https://visualstudio.microsoft.com/downloads/ 

    it will reinstall the Visual Studio Installer, then, you can check that your VS2022 works properly. 

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

     


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.