Click here to Skip to main content
15,890,512 members
Articles / Programming Languages / C#
Article

WebUpdate: Keep All Your Fat Client or Single User Applications Up To Date Simply!

Rate me:
Please Sign up or sign in to vote.
4.85/5 (58 votes)
26 Apr 2006CPOL3 min read 204.6K   2.3K   194   123
A simple way to keep all your fat client or single user applications up to date, easy to add to your projects and much easier than any other product to put online an update!
Sample Image - WebUpdate.jpg

Introduction

Automatically deploying your applications/resources/related files is a common and recurring problem that every developer making software for a large audience has to face!
WebUpdate offers a real easy and fast way to add a self-update ability to your application!

  • Update any kind of file based on date check
  • Each file can be updated individually (no need to redownload a full version if only one little file has changed)
  • No need to make a configuration file and specify manually each file that requires an update
  • All communications between the client and the Web service (the webupdate server part) are compressed to gain up to 60 % of bandwidth and update time!
  • Threaded
  • Reconstructs files and directories that have been deleted by the user
  • Easy to add to any project (less than 5 minutes!!!)
  • Easy to add a new update (put or overwrite files to be added/updated in the update folder on the server)
  • Automatically starts at startup or shutdown of your application
  • Ability to update the updater software!

Background

Before starting the development of webupdate (2004), I searched if someone had made something similar and I discovered Microsoft's application blocks : "Updater Application Block" which does the same thing but has some limitations:

  • The block relies on absolute path links being provided in the configuration file. This reliance causes big problems, because you can't always guarantee that users will install your application to a specific location.
  • When you want to add a new file to be updated, you have to modify a manifest file to set the file path for each file!
  • You have to play with a public/private RSA key. :(
  • A version is a set of files. So, if you want to update just one file you have to prepare a new update folder with a new manifest!
  • Every time the Updater downloads a new version of your application to the client, it creates a new folder to contain the new version; unfortunately, it leaves the folder(s) for the outdated version of your application and all its files intact. That's untidy. It leaves open the possibility for users to run an older version, and bloats the disk space requirements for your application.

Hopefully those limitations can be removed by extending the updater block with the interfaces IValidator, IPostProcessor and IDownloader but that is not the subject of this article.;)

The Update Process

A user starts your application, your application launches WebUpdate.exe.
WebUpdate asks the update server if WebUpdateClient.exe was updated and updates it if necessary. Webupdate.exe starts webupdateclient.exe which is the real updater. WebUpdateClient asks the server (a Web service installed on a Web server) for all file info about an appname (paths, sizes, last modifications) and compares the results to the local folder. Finally WebUpdateClient.exe asks for the required files. The server sends in response the required files through a compressed soap message. All updated files are updated or added to the application folder.

Using the Code

Given below is the code to add to your existing application Load method:

C#
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
psi.Arguments = "check";
psi.FileName = Application.StartupPath + "\\WebUpdate.exe";
psi.WorkingDirectory = Application.StartupPath + "\\";
psi.UseShellExecute = true;

System.Diagnostics.Process.Start( psi );

How To Install the Demo?

  1. Unzip webupdate_src.zip
  2. Create a virtual Web site for the folder WebUpdateWS
  3. Place some files to be updated or added on all clients computer in the folder WebUpdateWS\Updates\YOUR_APP_NAME_HERE\
  4. Edit the webupdateclient\bin\Debug\WebUpdate.ini file and set the line "Version=" to "Version=YOUR_APP_NAME_HERE"
  5. You can directly run a webupdate by launching webupdateclient\bin\Debug\WebUpdate.exe

Of course in a real application, you just need to xcopy all the contents of webupdateclient\bin\Debug\ near your main EXE and modify WebUpdate.exe.config and WebUpdateClient.exe.config to set the real Internet webupdate server HTTP address.

About the Compression

I used the library SharpZipLib and the excellent SoapExtender CompressionExtension from Saurabh Nandu.

Feel free to ask me any questions.
Joseph Benguira joseph@z51.biz

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
France France
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralRe: Really nice :) Pin
jocool255026-Apr-06 11:09
jocool255026-Apr-06 11:09 
GeneralRe: Really nice :) Pin
NinjaCross26-Apr-06 11:17
NinjaCross26-Apr-06 11:17 
GeneralFurther instructions please Pin
dave.kelly13-Mar-06 3:52
professionaldave.kelly13-Mar-06 3:52 
GeneralRe: Further instructions please Pin
jocool255013-Mar-06 4:19
jocool255013-Mar-06 4:19 
GeneralRe: Further instructions please Pin
dave.kelly13-Mar-06 4:53
professionaldave.kelly13-Mar-06 4:53 
GeneralRe: Further instructions please Pin
jocool255013-Mar-06 5:01
jocool255013-Mar-06 5:01 
GeneralRe: Further instructions please Pin
dave.kelly13-Mar-06 5:26
professionaldave.kelly13-Mar-06 5:26 
NewsRe: Further instructions please Pin
Civilised Barbarian28-Mar-06 21:22
Civilised Barbarian28-Mar-06 21:22 
Hi jocool2550

I've only just seen this project and I haven't studied it in detail yet, so forgive me if my comments are premature. They seem relevant to this particular message thread.

I am currently implementing something that sounds very similar to what you have produced, except that I am using a passive web site so it can be hosted on any server.

The web site has a configuration file that contains information about available updates. The web update program runs entirely on the client PC and is split into two parts (as you describe) to permit self-updating.

The update process consists of downloading the config file from the server using http and then comparing the versions of each component with those on the local PC. Any component for which an update is available is downloaded via http (or ftp), then unzipped and installed.

A further advantage is that the server config file contains the urls of the individual components, so that they can be stored in any convenient sub-folder of the site or even hosted elsewhere on the web, which might be useful for projects where sub-components are maintained by separate teams.

The web update program only needs to know the url of the server config file and this is held in a local configuration file, which can be updated (as part of the update process) if the site needs to be relocated to a new server. This local config file can also contain a list of alternative urls to be used if the primary server is down.

The only downside that I can see to this approach is that the security of the update components would not be as good (anyone could download them if they know the url), but this could be mitigated by pre-encrypting the zip files with a secret symmetric key that's embedded within the update program (key exchange is not possible for a passive site). I'm intending to write an uploader that would zip, encrypt, and upload individual components and automatically edit the server config file.

GeneralRe: Further instructions please Pin
jocool255030-Mar-06 0:14
jocool255030-Mar-06 0:14 
QuestionWhat about ClickOnce Pin
Mike Burroughs12-Mar-06 4:09
Mike Burroughs12-Mar-06 4:09 
AnswerRe: What about ClickOnce Pin
jocool255012-Mar-06 5:52
jocool255012-Mar-06 5:52 
GeneralRe: What about ClickOnce Pin
geo_m26-Mar-06 19:30
geo_m26-Mar-06 19:30 
Generalcipchk Pin
C_IPC11-Mar-06 21:22
C_IPC11-Mar-06 21:22 
GeneralRe: cipchk Pin
jocool255011-Mar-06 22:45
jocool255011-Mar-06 22:45 
GeneralNice Pin
Varindir Rajesh Mahdihar10-Mar-06 5:01
Varindir Rajesh Mahdihar10-Mar-06 5:01 
GeneralRe: Nice Pin
jocool255010-Mar-06 5:41
jocool255010-Mar-06 5:41 
GeneralExcellent !!!!!!! Pin
thrackan10-Mar-06 3:40
thrackan10-Mar-06 3:40 
GeneralRe: Excellent !!!!!!! Pin
jocool255010-Mar-06 3:41
jocool255010-Mar-06 3:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.