Removing Visual Studio components left behind after an uninstall

When you install Visual Studio and related content like Windows Kits or some add-ons, most packages that comprise those bundles are reference counted to make sure they are not removed prematurely. Uninstalling Visual Studio and related content should eventually remove those packages (i.e. last one out the door turns off the light). Contrast with older releases where almost everything was left installed because we couldn’t be sure which other products still required them.

Some packages, however, do get left behind. Some are packages that do not participate in package ref-counting – often those that we do not build. Some package may be left behind because uninstalling packages in Visual Studio (or any WiX bundle, for that matter) is a best-effort attempt. If a package fails, uninstall will move on to uninstall the next package. Some are just too essential for other products to uninstall like the .NET Framework and Visual C runtimes: of the vast number of installers that chain them, too few ref-count them to rely on that feature.

Whatever the cause, having components left behind will consume disk space and may cause troubles upgrading to Visual Studio RTM.

Starting with Visual Studio 2013, you can forcibly remove almost all components. A few core components – like the .NET Framework and VC runtimes – are left behind because of their ubiquity, though you can remove those separately from Programs and Features if you really want.

There are a couple ways you can do this.

Warning: This will remove all components regardless of whether other products require them. This may cause other products to function incorrectly or not function at all.

Forcibly uninstall using original installer

You do not need to have a bundle installed to forcibly uninstall packages by default. If you have the original installer – say, a previous download – you can run it directly like so:

vs_enterprise.exe /uninstall /force

Visual Studio will present its normal maintenance mode user interface, so select Uninstall to proceed. You could also pass /passive (no user input required – just progress displayed) or /quiet to the above command line.

Forcibly uninstall installed bundle

Much like the previous instructions, the trick here is to find where the cached bundle is installed since Visual Studio does not expose this functionality from the user interface. You could, for example, go to Programs and Features, find and select Visual Studio, and click Change to just start the operation. Cancel, then to go %TEMP% and look for the most recent log file name matching dd_*.log, like dd_vs_enterprise_20150714113625.log. The very first line in that log will contain the path. For example,

[0FD8:44D4][2015-07-14T11:36:24]i001: Burn v3.7.4029.0, Windows v10.0 (Build 10240: Service Pack 0), path: C:\ProgramData\Package Cache\{a60a492e-b5eb-4218-a9e6-f38d18a7dbaf}\vs_enterprise.exe, cmdline: '/modify'

Copy that path, enclose it in quotes, and run it like in the previous instructions:

"C:\ProgramData\Package Cache\{a60a492e-b5eb-4218-a9e6-f38d18a7dbaf}\vs_enterprise.exe" /uninstall /force

Again, you may choose to pass /passive or /quiet on the command line.