views:

436

answers:

5

I've got a click once 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 docs and other SO 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/data files. I'm making no changes whatsoever to the application, just pushing deploy again in Visual Studio.

Any ideas?

Updates:

The problem seems to happen on both Windows 7 and XP. 64 bit windows and 32.

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.

MORE Updates

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

Does anyone know anything about click-once deployment? Or is it just a mysterious black box to everyone?

A: 

Are you checking it immediately? They don't even go away after a day or so? The ClickOnce scavenger service is supposed to come around and remove the old versions. If you push the most recent version as a required update, does it remove the other versions? (To do this, set the minimum required version in the Updates dialog to the same version you are deploying).

RobinDotNet
The minimum required version doesn't do anything. Is there a way to run this "ClickOnce scavenger" service immediately? Is there any documentation about this scavenger service? I've not heard of it
Clyde
Furthermore, I created a new windows forms app and deployed it with click once and it did behave correctly, leaving only two versions. So there is something about my real app that is different, but I can't find any difference in their publish configuration.
Clyde
And yes, they're still there a day later
Clyde
Can you provide any links to MSDN about this scavenger service? I couldn't find it, but I'm probably just missing the obvious here.
Clyde
A: 

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?

RobinDotNet
It's a winforms app and does have the two types of folders you described. There are only two "exe" folders, and they contain the application icon, config file, and a chm help file I've got included as application content.It is the "tion" folders that are being endlessly duplicated. Every single one contains the exe, all the dlls, PLUS the files that were in the "exe" folder, including the 10 meg chm file.
Clyde
I don't know if it matters, but I do not have the app auto-check version on startup -- that's handled in code using ApplicationDeployment.CurrentDeployment.CheckForDetailedUpdate and then ApplicationDeployment.CurrentDeployment.Update()
Clyde
have you tried changing it to auto update and see if it clears out the files?
RobinDotNet
A: 

Hi,

How to Delete

Clear Click-Once (versioning) Cache

From the docs:

ClickOnce applications that are hosted online are restricted in the amount of space they can occupy by a quota that constrains the size of the ClickOnce cache. The cache size applies to all the user's online applications; a single partially-trusted, online application is limited to occupying half of the quota space. Installed applications are not limited by the cache size and do not count against the cache limit. For all ClickOnce applications, the cache retains only the current version and the previously installed version. By default, client computers have 250 MB of storage for online ClickOnce applications. Data files do not count toward this limit. A system administrator can enlarge or reduce this quota on a particular client computer by changing the registry key, HKEY_CURRENT_USER\Software\Classes\Software\Microsoft\Windows\CurrentVersion\Deployment\OnlineAppQuotaInKB, which is a DWORD value that expresses the cache size in kilobytes. For example, in order to reduce the cache size to 50 MB, you would change this value to 51200

Theofanis Pantelides
I think you've misinterpreted the docs -- this cache limit is the total limit for all click-once applications on the machine. For a single application, "the cache retains only the current version and the previously installed version" http://msdn.microsoft.com/en-us/library/267k390a(v=VS.100).aspx
Clyde
A: 

Someone has posted this exact question to the MSDN ClickOnce forum -- is that you or just completely coincidental?

You're doing programmatic updates. Synchronous or asynchronous? Are you restarting the application after doing the update? (Application.Restart();)

Are you deploying a new version to the server with a new version number?

Did you set the UpdateURL in the Updates dialog in the Publish property page?

RobinDotNet
Yes that was me. Synchronous updates, and a restart afterwards. Yes, I'm deploying a new version to the server....No, there is not a separate updates url. Again, I'll reiterate that the update is working fine -- it's only the post-update cleanup.
Clyde
Yeah, I'm trying to figure out the pattern. You may have found a bug.Can you answer my questions in the thread in the forum?
RobinDotNet
+2  A: 

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.

Clyde