I start my day from reading articles on CodeProject.com and found very interesting one: http://www.codeproject.com/KB/install/DDayUpdate_Part1.aspx
It's based on ClickOne technology and provide easy way to update own applications. Do you want to know how to implement something like ClickOnce Auto Update by own hands? I'm sure you want...
I name this article "Auto Update Application Block", so I hope this will not confuse anyone.
Auto Update Application Block
First, let's start from the diagrams:

Application start will look something like that:

Introduction
Application block does not have on current moment full implementation, but several parts of it already implemented and successfully used in internal projetcs. This article mostly describe concept of Auto Update block for minimizing time required for design and implementation by other developers.
Architecure
USE CASE: How to use application block in application by developers
- Attach into solution ArtfulBits.AutoUpdate project;
- result of the project embed as a resource into result application;
- attach into application our helper class (as additional assembly or as source file);
- add into startup application point (source code) execution of our autoupdate check;
As a result auto update block attached to a application in 5 minutes without any additional programming.
Analysis of USE CASES (not only one written upper) - Feature List:
- Auto Update have to start as a stand alone process, otherwise replacement of the original application executables not possible;
- Auto Update have to work with http and file URIs;
- Auto Update have to allow run custom actions before and after files updates, that allowing to create advance automatic updates scenarios;
- Auto Update can be started as a background process;
- Auto Update block must allow self update;
Update Application Parameters
- PID - process ID of application exit of which we have to wait before installing updates;
- URL - url to the server where hosted updates;
- PROXY - proxy configuration; (OPTIONAL)
Algorithm of work
- try to reach by specified by user URL xml file with update information:
- validate XML before processing;
- update information can be a part of bigger XML document with another hierarchy;
- folders structure of files - PATH INFORMATION;
- Extract version information from XML;
- Check current version information of application:
- extract version information from assemblies metadata;
- user provide us required information:
- in XML format;
- in event based model (custom user code);
- Compare current and extracted version information:
- if version greater current - DOWNLOAD;
- if version less then current - IGNORE;
- if version not defined - ALWAYS DOWNLOAD/UPDATE:
- if version -1 - CHECK ONLY FILE EXISTENCE AND SIZE;
- List of files for updating put into DOWNLOAD QUEUE:
- Show user Dialog with progress;
- Provide events that control download progress;
- All files we download into temporary folder;
- Run UPGRADE of files:
- Copy all old files into backup dir;
- Run uninstall actions:
- defined in XML;
- defined by user in Runtime;
- Replace old files by new one;
- Run custom install actions (only after we copy all files):
- GAC, NGEN, COM, WinService, CMD EXEC;
- provide interface for applying custom user actions;
Example of XML auto update file:
| <root version="1.0.0.0"> |
| <file name="tracker.dll" gac="yes|no" ngen="yes|no" com="yes|no" winservice="yes|no"> |
| <path>...destination path... %WINDIR%\folder</path> |
| <size>10345</size> |
| <version>1.0.0.0</version> |
| <description>some text here</description> |
| </file> |
| </root> |
Currently rated 4.2 by 6 people
- Currently 4.166667/5 Stars.
- 1
- 2
- 3
- 4
- 5