Clickonce Cache Corruption and Reset

Clickonce Cache Corruption

Several dozen users have reported errors that occur when trying to install DCP that have all turned out to be clickonce cache corruption.

I thought I would write a quick guide on recognising the error and also how to fix the issue.

Context

DCP is a clickonce application whose installation and running are managed by the windows clickonce runtime.

There is no installer for DCP, simply an application manifest file eg CurrentPatient.application that exist on the web.

The file contains text manifest information for the DCP which the clickonce runtime uses to install the DCP if not already installed and run.

The file can be run from the web or downloaded and run locally. Either will trigger the Clickonce runtime on your PC to read the file and act on the content of the manifest.

When installed, the DCP icon on the start menu is just a pointer to the install location listed in the application manifest.

The actual application is installed into the users C:\Users\username\AppData\Local directory and not in c:\Program Files.

Clickonce Cache

The list of applications and information on the clickonce cache is maintained in windows.

Due to the vagaries of windows this cache information can become corrupted due to unexpected shutdowns etc

Once the cache information is corrupted all installed clickonce applications become unavailable and no further applications relying on clickonce can be installed.

Clickonce Corrupted Cache Fix

There are several different methods to correct Clickonce cache corruption that are mentioned on the web and in microsoft documentation.

However, the only sure fire way to fix the issue is to delete the clickonce cache directory and all subdirectories.

It is recommended to backup the directory first however I have not seen any real benefit as all clickonce applications will need to be re-installed anyway.

To find the correct directory to delete, navigate to your user profile directory and the subdirectory AppData\Local

eg. C:\Users[username]\AppData\Local\Apps\2.0\

Under there you will find the tow directories

Appdatadir

Delete the directory that is NOT named Data. ie the one with the random name - yours will be different.

Following deleting the directory clickonce will regenerate the app directory when the next clickonce application is installed. The app directory will have a new random name.