Does Anyone have a good example

Topics: Updater Application Block
Aug 11, 2004 at 1:16 PM
originally posted by: painlessprod

My frustration with this UAB so far is I can't find any good examples on the net of source.

Specifically I'm having problems with starting up and restrting apps if they are running.

I have a dir structure like this

C:\AppUpdater \\ in this i have my Updater
C:\AppUpdater\Foo \\ is where my apps are to be located and where i hold my version.xml

then i get my versions going on and on from there
I don't quite understand if the updater is a self contained exe and my apps are called in post processing or if i should have it within my apps and it shuts down and restarts for me automatically when a newer version is available.

Also Paths
Can't i just put a stub on the clients computer and it pulls everythig down or what's the deal

Sorry just need a beeter set of basic docs on this bad boy

a url would help
Aug 20, 2004 at 4:38 AM
originally posted by: pccoxDMR

We use the Self-Updating model that's laid out in the examples with the UAB download. The controller is built into our app using a dedicated class (which is actually a Form class that serves as a splash screen for the app). It does the polling, downloading, etc. The app itself is actually launched using a separate Launcher stub app, as shown in the sample. That way, the app can restart by running the launcher, so there's not a process conflict.

Our folder structure is as follows:

C:\MyApp\ -- this is where the Launcher lives
C:\MyApp\<version> -- where <version> is the actual version number of the release. This is where the app itself (and all satellite assemblies) lives.

The downloader downloads to C:\MyApp\<newversion> where <newversion> is the version number of the update being downloaded. On restart, the launcher runs the app out of C:\MyApp\<newversion>, so it runs the update.

We pretty much use the Self-Updating example as is, but I did modify it slightly. I added code to the StartUpdater() method of the Controller (Form) class to remove Updater log files older than a certain time frame, so the logs don't create unnecessary clutter. Also, I added code to the Launcher app in the example to delete the previous version on the restart, so we don't end up with multiple old version folders on the users' systems (we keep the old versions in our update posting folder on the update server). Finally, I added a couple of new events to the BITSDownloader class to notify the client app on errors and if there's no update needed.

Basically, follow the QuickStart sample for the Self-Updating model, and you should be fine. That seems to be the simplest to implement, unless you want to write some system tray-level process to monitor and update the app(s) remotely. That was more than we needed, so we didn't pursue that model.

Also, look in the Help doc that comes with the UAB (Docs folder) under "Design of the Updater Application Block". Read the "Application Launcher Design" page to see the folder structure and get a feel for how the restart, etc. flows.

I hope that helps some...

Paul C.