Clear ClickOnce leftovers

Mar 11, 2018  

I’ve been struggling with recent versions of Visual Studio 2017 and ClickOnce for several months, without being able to resolve all my issues (impossible code signing with an external tool, broken automatic update, broken file associations after manual update, .NET 4.7.1 and Nuget difficulties to name a few), so I finally decided to give up ClickOnce completely and get back to a plain old (and trusted) installer.

Getting rid of failed ClickOnce installs

In order to remove all ClickOnce applications, I followed these steps:

  • Uninstall what can be uninstalled from Add and Remove Control Panel applet.
  • Execute rundll32 C:\Windows\system32\dfshim.dll CleanOnlineAppCache
  • Execute mage.exe -cc
  • Delete all content from %LocalAppData%\Apps\2.0.
  • Delete shortcuts still found in the Start Menu, by opening %AppData%\Microsoft\Windows\Start Menu\Programs\...

mage.exe can be found in one of the Microsoft SDKs subfolders. In my case, I found it at C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools. Just in case, here is a copy of mage.