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

Gil Sharon 20 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,053 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,359 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
10,455 questions
{count} votes

Accepted answer
  1. Anna Xiu-MSFT 30,791 Reputation points Microsoft Vendor
    2025-01-03T07:27:45.2133333+00:00

    Hello, do you have any errors or warnings during installing VS? Have you changed any registry or environment variables?

    Please check the default installation path in Windows Settings:

    1. Open Registry Editor.
    2. Navigate to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
    3. Check if the ProgramFilesDir and ProgramFilesDir (x86) entries are pointing to C drive.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Ziqun Liu 20 Reputation points
    2025-01-16T02:43:30.46+00:00

    Hi,

    I have similar problem. I want to download Python Tool. When I clicked Tools -> Get Tools and Features, I also get error "Unable to locate Visual Studio Installer" and I click okay on the prompt there was another error message "Operation is not valid due to the current state of the object".

    I tried all of the above suggestions and the errors persist. Could you shed some lights?

    Ziqun


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.