5,693,062 members and growing! (13,860 online)
Email Password   helpLost your password?
Languages » C# » General     Intermediate License: The Code Project Open License (CPOL)

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

By jocool2550

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!
C#, Windows, .NET, Visual Studio, Dev

Posted: 10 Mar 2006
Updated: 26 Apr 2006
Views: 59,397
Bookmarked: 144 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
54 votes for this Article.
Popularity: 7.65 Rating: 4.42 out of 5
2 votes, 3.7%
1
3 votes, 5.6%
2
1 vote, 1.9%
3
7 votes, 13.0%
4
41 votes, 75.9%
5
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:

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)

About the Author

jocool2550



Occupation: Web Developer
Location: France France

Other popular C# articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 25 of 101 (Total in Forum: 101) (Refresh)FirstPrevNext
Generalusing the client on a web sitemembergedw9910:29 22 Oct '08  
GeneralHow to implement?memberDuBro7:08 30 Mar '08  
GeneralRe: How to implement?memberjocool25503:12 1 Apr '08  
GeneralMD5 Hash instead of file timememberJacques Doubell22:25 30 Jan '08  
GeneralRe: MD5 Hash instead of file timememberjocool255010:54 31 Jan '08  
QuestionYet another request for posting the VS2005 Versionmemberdirk_kaiser0:37 6 Jul '07  
QuestionDatabase SQL Updates ?memberHantoush16:26 18 Jun '07  
AnswerRe: Database SQL Updates ?memberjocool255022:23 18 Jun '07  
QuestionDoes it work on webserver with PHP/MYSQL?memberHantoush16:21 18 Jun '07  
AnswerRe: Does it work on webserver with PHP/MYSQL?memberjocool255022:21 18 Jun '07  
Question"Proxy Authentication Required"memberfhei2:11 12 Jun '07  
AnswerRe: "Proxy Authentication Required"memberjocool25503:30 12 Jun '07  
QuestionRe: "Proxy Authentication Required"memberfhei4:08 12 Jun '07  
GeneralRe: "Proxy Authentication Required"memberjocool25504:13 12 Jun '07  
GeneralSoap Exception Under 2.0memberDuBro21:58 11 Jun '07  
GeneralRe: Soap Exception Under 2.0memberjocool255022:01 11 Jun '07  
GeneralRe: Soap Exception Under 2.0memberDuBro22:13 11 Jun '07  
General2.0memberDuBro22:22 10 Jun '07  
GeneralRe: 2.0memberjocool255022:44 10 Jun '07  
GeneralRe: 2.0 [modified]memberDuBro22:49 10 Jun '07  
GeneralUnKnown Exceptionmemberilovejolly23:25 10 Apr '07  
GeneralRe: UnKnown Exceptionmemberjocool25500:18 11 Apr '07  
GeneralTimeout for Webservicemembereshaghi2:00 27 Mar '07  
QuestionSoap Response for version [modified]membereshaghi2:38 20 Feb '07  
AnswerRe: Soap Response for versionmemberjocool25503:03 20 Feb '07  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 26 Apr 2006
Editor: Deeksha Shenoy
Copyright 2006 by jocool2550
Everything else Copyright © CodeProject, 1999-2008
Web12 | Advertise on the Code Project