Introducing the Updater Application Block
The Updater block lets you deploy updates to a central deployment server and have all of your .NET Windows Forms applications automatically check for and download updated files. For each update, you deploy all the new version's files to a folder on the deployment server, which contains a configuration file known as the server manifest. On the client, a small application, AppStart.exe
, serves as a controller that launches an instance of your application, loads information about the installed version from a client-side manifest, and periodically polls the server for the availability of updates. This entire process is transparent to users, who don't have to do anything special to receive or install application updates. When AppStart.exe
discovers an update, it downloads the updated files on a background thread, minimizing disruption to the user.
The Resources section provides a link to the Updater block's documentation on MSDN. The documentation provides a comprehensive overview of how the block works, and the basics of how to implement it. Although the documentation is good, there's a lot of it, and the block can be tricky to configure and get working. There are also one or two issues with the way the block has been designed which you'll need to resolve. Fortunately, the block comes complete with source code, so you'll see how to customize AppStart.exe
to provide the features you need for your own applications.
To begin, download the Updater block installer
and run it to install the documentation and source code. Note that the installer installs both VB.NET source and C# source even though this article uses only C# for the examples. You will need to integrate the Updater Block source code with your own Windows Forms solution, so take a copy of the source from the following location :
<span class="pf">C:\Program Files\Microsoft Application Blocks for
This folder contains the source code directories listed in Table 1, which you should copy into your application's solution folder:
Table 1. Copy the directories shown in the Folder column into your solution's folder. The Notes column shows a description of each folder's contents.
||Contains code for the AppStart assembly, which is the host process that will run your application and manage polling of the update server and download of files. References the ApplicationUpdater assembly.
||The main Updater assembly.
||Referenced by the Updater assembly, and used to provide the base interfaces for creating custom downloaders, post-processors, and validators to extend the application block.
|Microsoft.ApplicationBlocks.ExceptionManagement & Microsoft.ApplicationBlocks.ExceptionManagement.Interfaces
||The Exception Management application block assemblies, which are referenced by AppStart and the Updater assembly.
After copying the source code into your solution folder, open up your solution in Visual Studio.NET, and add the new projects to your solution; you should also ensure that the references between the projects are set up as described in Table 1.