Cleaning up corrupt Visual Studio instances

Heath Stewart

A small number of users are seeing errors after installing or modifying Visual Studio 2017 like the following,

Sorry, the installation failed. Please try again.

This may also manifest in some cases as,

A product matching the following parameters cannot be found:

channelId: VisualStudio.15.Release productId: Microsoft.VisualStudio.Product.Enterprise

If you open the latest %TEMP%\dd_client*.log file you may see an exception stack trace like,

2017-08-07T03:20:00 : Error : Failed to get installed product summaries. [installerId: SetupEngine, error: System.NullReferenceException: Object reference not set to an instance of an object.
  at Microsoft.VisualStudio.Setup.Cache.InstanceRepository.GetInstance()
  at Microsoft.VisualStudio.Setup.Cache.CacheRepository.d__32.MoveNext()
  at Microsoft.VisualStudio.Setup.InstalledProductsProviderService.GetInstalledProductSummariesImpl()
  at Microsoft.VisualStudio.Setup.InstalledProductsProviderService.GetInstalledProductSummaries()

Subsequent operations in the Visual Studio Installer fail, and if you reopen the Visual Studio Installer you may not see any instances installed – only what products are available.

Solution

We have mitigated a couple of possible causes and continue to explore both mitigations and long-term remedies, but in the meantime, you will need to clean up, or obliterate, the instance and re-install.

  1. Open an elevated command prompt.
  2. Run: %ProgramFiles(x86)%\Microsoft Visual Studio\Installer\resources\app\layout\InstallCleanup.exe -i

This will clean up only instance data such as the installation directory and state. This will make re-installing the instance faster since any workloads and components you had installed would remain cached and would not be re-downloaded.

If you don’t not find InstallCleanup.exe in %ProgramFiles(x86)%\Microsoft Visual Studio\Installer\resources\app\layout – or any directory there above – please download the latest bootstrapper from https://www.visualstudio.com/downloads/ and run it to install. When the workload selection dialog is shown, close the window and run the steps above again.

Update: for up-to-date information, please see https://aka.ms/vs/cleanup.

3 comments

Discussion is closed. Login to edit/delete existing comments.

  • Omphe Disang 0

    Hi. What happen when I try to install visual studio 2015 community, while I’m installing it open for 10 sec then it close and it don’t show anything

  • KAREEM SULTHAN 0

    If you follow these steps you will be left with a feeling that you are a stupid. It just deletes all the files of current installation. When you open Visual Studio after performing these steps there will be nothing. Opening VS installer will prompt you to download and install the VS freshly because all the folders will be left empty after performing thise steps. I don’t know how Microsoft encourages these kind of blogs which simply pisses off VS users. 

    • D.Mac 0

      @KAREEM SULTHAN – I wish I’d read your comment before following these steps. I am now left with a feeling that I am stupid… 🙁 lol

Feedback usabilla icon