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!
- 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!
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
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?
- Unzip webupdate_src.zip
- Create a virtual Web site for the folder WebUpdateWS
- Place some files to be updated or added on all clients computer in the folder WebUpdateWS\Updates\YOUR_APP_NAME_HERE\
- Edit the webupdateclient\bin\Debug\WebUpdate.ini file and set the line "
Version=" to "
- 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 firstname.lastname@example.org
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.