Making your Application Automatically Update Itself
I've always thought it was the height of classiness when an application lets me know that there's a new version available. Even little applications with no installer like Lutz's Reflector update themselves automatically.
There's lots of ways to implement an automatic update check in your application, and many products that say they'll do it automatically.
From my point of view, there's a number of levels of "coolness" in auto-updating. Now, all this assumes you're NOT using ClickOnce.
Cool:
- Add a "Check for Update" menu that just launches the default browser like www.foo.com/update.aspx?version=3.3.4.4 where 3.3.4.4 is your own Main Assembly Version. Then the requested page just lets them know if they've got the latest or not.
- You can get your app's version number via System.Windows.Forms.Application.ProductVersion() or System.Reflection. Assembly.GetExecutingAssembly(). GetName().Version.ToString(). Whew!
Cooler would be:
- Add a "Check for Update" menu that retrieves via a programmatic HTTP GET some XML from www.foo.com/update.aspx?version=3.3.4.4. Then report INSIDE your app if the user needs to upgrade.
Cooler still would be:
- Bonus points for checking once a day/week/month for updates, silently, gracefully.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
