Check for updates: how to download and install a new version of your C# application

In one of the previous tutorials I described a simple solution that allows an application to check if a new version is available. The solution presented there has two major flaws:

  • while doing the check the main application thread is blocked, thus making the application UI not responsive to user actions
  • after finding a new version the user had to download and install it manually

A moderately skilled C# programmer should be able to solve these two problems easily. So in this tutorial we will learn how to implement our ‘check for updates’ option in a more advanced way. We will work with threads, events and delegates.

Read more

Adding “Check for update” feature to your C# application

Today I decided I would add a ‘check for update’ option to my Eyes Relax application. This is quite useful feature, especially when you host your application on many hosting servers (like download.com and others). In this case it can be difficult for the user to check if there is a newer version of your software available, because:

  • the user does not remember where he downloaded the application from
  • there is an older version on the hosting server, so the user is not aware that there is a newer version of your app available
  • simple, but very common reason: the user is too lazy to look for the new version :P; and because it’s easier to simply select the ‘update’ option in your application, it may work for lazy users

Beside those reasons this is a nice, small feature we can practice our c# programming skills on :). At least for me, because I’ve spent last two years mainly developing server modules in Python. Two major subjects are:

  • HTTP file downloading
  • simple XML parsing (XmlTextReader)

Let’s start.

Read more