Tuesday, May 20, 2008
« Magenic Technology Summit | Main | The ]inbetween[ event - very cool! »

I was just in a discussion about ClickOnce with several people, include Brian Noyes, who wrote the book on ClickOnce.

I was under the mistaken impression, and I know quite a few other people who have this same misconception, that ClickOnce downloads complete new versions of your application each time you publish a new version. In fact, I know of at least a couple companies who specifically chose not to use ClickOnce because their app is quite large, and re-downloading the whole thing each time a new version is published is unrealistic.

It turns out though, that ClickOnce does optimize the download. When you publish a new version of your app, all the new files are written to the server, that is true. But the client only downloads changed files. All unchanged files are copied from the previous install folder on the client to the new install folder on the client.

In other words, all unchanged files are reused from the copy already on the client, and so are not downloaded again. Only changed files are downloaded from the server.

The trick to making this work is to only rebuild assemblies that have actually changed before you do a publish. Don't rebuild unchanged assemblies, because that could change the assembly - and even a one byte change in the assembly would cause it to be downloaded because the file hash would be different.

Saying that gives me flashbacks to binary compatibility issues with VB6, but it makes complete sense that they'd have to use something like a file hash to decide whether to re-download each file.

Tuesday, May 20, 2008 9:00:29 AM (Central Standard Time, UTC-06:00)  #    Disclaimer  |  Comments [3]  | 

Tuesday, May 20, 2008 2:09:57 PM (Central Standard Time, UTC-06:00)
It's easy to get the impression it downloads the entire application again because the progress bar still shows the entire size of your application rather than the size of the changed assemblies it actually downloads. I was paranoid about that but confirmed it does work by using a bandwidth monitor.

We ended up rolling our own windows forms app to create our ClickOnce deployments because Visual Studio and Mage just didn't cut it. One big advantage we get is that when we create a new deployment, we use the existing deployment on the server as a starting point. Then we copy over top of that only files we want to deploy. This saves us from the scenario of accidentally deploying something just because it was built and the hash changed. It also saves us from having to give our certificate password to everyone who needs to be able to create deployments.
chichikov
Sunday, June 01, 2008 4:41:48 PM (Central Standard Time, UTC-06:00)
I've heard that ClickOnce will only download what it needs, but I've never been able to make it work. We have 3rd party DLLs in our project and it even downloads those every time (obviously I'm not rebuilding those).

@chichikov - are you saying that when the download happens it doesn't actually download as much data as it says it is? You don't just have a progress bar -- it also tells you have many MBs are left to download.
Thursday, July 10, 2008 9:12:48 AM (Central Standard Time, UTC-06:00)
@jonkruger
Correct, Jon. Even though the little dialog says it's downloading X number of MB, it's really not. It's only downloading the changed assemblies. I didn't believe it either but verified it with a bandwidth monitor. Also, we're deploying some huge apps (25+ MB range) to dial-up clients and are not receiving any complaints after the initial install.
chichikov
Comments are closed.