Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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:

MyApp.exe.manifest
MyApp.exe.cdf-ms
MyDll1.cdf-ms
MyDll2.cdf-ms

No actual executable files are different, nor the MyApp.manifest, MyDll1.manifest, 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?

like image 818
Clyde Avatar asked May 20 '10 12:05

Clyde


People also ask

What is ClickOnce deployment?

ClickOnce is a deployment technology that enables you to create self-updating Windows-based applications that can be installed and run with minimal user interaction.

Is ClickOnce still supported?

ClickOnce and DirectInvoke in Microsoft Edge | Microsoft Learn. This browser is no longer supported. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

How do I stop ClickOnce manifest signing?

To disable ClickOnce security settings With a project selected in Solution Explorer, on the Project menu, click Properties. Click the Security tab. Clear the Enable ClickOnce Security Settings check box.


2 Answers

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.

like image 61
Clyde Avatar answered Sep 24 '22 12:09

Clyde


The scavenger service is part of the ClickOnce engine; it runs automatically, and isn't something you can access directly. It should be coming around and cleaning up the old versions.

Question about the min version. If you deploy new version & set min required version to new version#, does it update the app to that version? Then leaves the former one(s) on disk?

Is there any pattern that you can see? Is there a limit to the number of deployments that it is caching?

There's also something about shadow folders that is tickling the edges of my memory; the files aren't really there. I'll do a little research and look through my notes and see what I can find.

What kind of app is it? WinForms/WPF/VSTO?

When you say it is caching folders, which folder is it? For a winforms app, for example, there are two folders created for each version (xxxxtion... and xxxxexe... or something like that) plus a bunch of folders -- one for each assembly included in the deployment -- these are cached versions of the assemblies, to keep from having to download them every time if they haven't changed. Is it the xxxxtion and xxxxexe folders that you are seeing multiples of?

like image 43
RobinDotNet Avatar answered Sep 25 '22 12:09

RobinDotNet