Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Keep your Apps Fresh with the MS Updater Application Block : Page 4

Transform your .NET Windows Forms client applications into self-updating "smart clients" with Microsoft's Updater Application Block.


advertisement
Configuring AppStart
Because AppStart is responsible for launching the latest version of your application, and polling the deployment server for updates, it requires a hefty set of configuration data before it will work. This is possibly the trickiest part of the process, as there are numerous settings and each must be configured exactly right. On top of this, there are a few "gotchas" and problems you will need to work through.

The Updater block documentation lists several ways to configure AppStart, but by far the easiest and most flexible approach is to put the configuration for both AppStart and the Application Updater assembly into a single app.config file in the AppStart project. You need to add the app.config file yourself (Add | New Item | Application Configuration File).

The documentation for the block lists the required settings in some detail, so I won't reproduce them here, but you should note the following caveats:

The AppStart app.config holds the configuration settings for both the AppStart and AppUpdater assemblies, so create sections for both assemblies in the <configSections> tag, as follows:

<configSections> <section name="appStart" type="Microsoft.ApplicationBlocks. ApplicationUpdater.AppStart. ConfigSectionHandler ,AppStart" /> <section name="appUpdater" type="Microsoft.ApplicationBlocks. ApplicationUpdater.UpdaterSectionHandler, Microsoft.ApplicationBlocks. ApplicationUpdater" /> </configSections>

In the <appStart> section you set configuration data about your installed application, including the name of your application's .exe file, the initial version (which you should explicitly set in the AssemblyInfo.cs file), and the last updated timestamp (just use the default setting defined in the documentation).

You will also need to specify the folder where AppStart can locate your application exe file; unfortunately, this <appFolderName> setting requires an absolute path to your application's executable file. This is a design flaw with the current version of the block—you can only specify an absolute path if you know with absolute certainty where your application will be installed. Unfortunately, users can elect to install your application to any location they like on their machine. This may not be a problem for you (for instance, if you work within an organization and can dictate installation locations), but if it is you'll find one possible solution later in this article. For now, define the <appFolderName> as a location relative to the AppStart.exe location—the folder that you earlier named "1.0.0.0", the initial version of your application.

You also need to set the <installedVersion> tag to this value, to indicate to the Updater which version of your application the user initially has installed. At runtime the Updater compares this version with the version specified in the server manifest, and only downloads updates with a higher version number. The Updater creates a new folder for the downloaded application files, named after the folder that contained the update on the server (this is where a good update folder naming convention comes in handy—name the folders after the version numbers they represent). After the download is complete, the Updater changes the value of the <appFolderName> element to the newly created folder, and changes <installedVersion> to reflect the new version number. This ensures that AppStart will launch the newly installed version the next time the user launches your application.

Your <appStart> config section should resemble the example below:

<appStart> <ClientApplicationInfo> <appFolderName>\1.0.0.0</appFolderName> <appExeName>WinFormsApplication.exe</appExeName> <installedVersion>1.0.0.0</installedVersion> <lastUpdated> 2003-05-04T14:49:18.4483296-05:00 </lastUpdated> </ClientApplicationInfo> </appStart>



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date