Clyde Clyde - 1 year ago 95
C# Question

ClickOnce deployment is leaving multiple versions (yes, more than two)

I've got a ClickOnce application that is leaving all old versions on my disk. It's an internal corporate application that gets frequent updates, so this is a disaster for rapidly inflating our backup size.

According to the documentation and other Stack Overflow questions, it is supposed to only leave the current and previous versions on disk. However, each time I deploy the project and upgrade a client, I get another copy of all EXE, DLL and data files. I'm not making any changes whatsoever to the application, just pushing deploy again in Visual Studio.

How do I fix this problem?

The problem seems to happen on both Windows 7 and Windows XP, as well as 64-bit and 32-bit Windows.

I've done a diff of the folders where the version is installed and the following files are different:


No actual executable files are different, nor the
, etc.

How about an alternative. Is it safe to look for other folders containing my application at runtime and delete them? Is that going to break anything?

Is ClickOnce just an apparent mysterious black box?

Answer Source

I think I've actually finally figured this one out. For some unknown (and unacceptable, frankly) reason, the cleanup of older versions will not happen if the newer version is running -- it just fails silently.

The cleanup attempts to run as the old version exits, but because I restarted the app, the new version is already starting, blocking the cleanup.

Also, note that the "scavenger service" mentioned in other answers appears to be a total fabrication. I've found no documentation of any such service, nor any evidence of it running. The cleanup appears to happen inline as part of the clickonce update process.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download