|
|
Microsoft Updater Application Block - Setup Files and DirectoriesOverview of Files and Directories | | Setup of files and directories is key to getting the Updater Application Block to work, and there are a lot of detail and nuances. This is the third article in a series that I am writing on the use of the Updater Application Block. Obviously, I am not the first to write on this subject. As I have built a Wrapper DLL for a Self-Updating Application, I simply am chronicling the steps that I have followed and learned. The companion article for this one is about creating the code for a Wrapper DLL, which wraps the code for the Self Updating Application into a reusable DLL.
Attention to detail is the watchword in gettng the Updater to work. Let me give you a hint; when it doesn't work, check the log, it may have the answer.
To see a picture of the Client and Server Infrastructure that supports the Updater Application Block, Click Here.
Server Directory Layouts (local machine acting as server)
First, I will set up a directory, from which to execute the Client Application, as follows:
Client Application Execution Directories
C:\Self Updating Application\DemoApp\1.0.0.0
In \DemoApp, I will place the following files.
AppStart.exe (MS Updater Shim application)
AppStart.exe.config (points to the current version of the Client App to run) (Click to see file)
I copied the AppStart.exe and AppStart.exe.config files (from the Microsoft Application Updater block demo files) into the directory. As I explained in the early articles, the AppStart.exe is a "shim" application used by the system to facilitate stopping and starting a new version of the self-updating application. One of the main purposes of this shim is to have a desktop Icon always start the AppStart program so that as the new version of an application is downloaded, the user never has to be concerned with where the new version resides or have to change the properties of the Icon. The AppStart.exe.config file always points to the latest version of the client application.
During the process of making a ServerManifest.xml file, I will create a PrivateKey.xml and PublicKey.xml and also save them in the \DemoApp folder for future use.
In the \DemoApp\1.0.0.0 folder, I will place the client application files as follows:
TestUABSelfUpdater.exe
TestUABSelfUpdater.pdb
TestUABSelfUpdater.exe.config Click to see this file.
UABWrapper.DLL
UABWrapper.pdb
I will also place the a copy of the Microsoft Appliation Updater Block files(dlls) so that the client app can use them. You can download them from the Microsoft Link above.
Next, I set up a server on my test machine by creating the following folder.
C:\Intepub\AppUpdates
Next, I create a virtual directory from this directory that will contain two types of files. These are the files for the new version.
Use IIS Manager to create a Virtual Directory from the physical directory. Enable Directory Browsing for this virtual directory. Remember the URL as you will need to use it in a later step.
ServerManifest.XML - Manifest file that describes the application files to be downloaded.
TestUABSelfUpdater.exe
TestUABSelfUpdater.pdb
TestUABSelfUpdater.exe.config
UABWrapper.DLL
UABWrapper.pdb
AppStart.exe.config
The AppStart.exe will use this file to locate and start the client application. The contents of this file will look as follows. You will see that <appFolderName> key points to the client application shown in Figure 2 above. Strings colored Red are strings that must be changed to your settings.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="appStart" type="Microsoft.ApplicationBlocks.ApplicationUpdater.AppStart.ConfigSectionHandler,AppStart" />
</configSections>
<appStart>
<ClientApplicationInfo>
<appFolderName>C:\Self Updating Application\DemoApp\1.0.0.0</appFolderName>
<appExeName>TestUABSelfUpdater.exe</appExeName>
<installedVersion>1.0.0.0</installedVersion>
<lastUpdated>2005-01-30T13:54:32.5245693-05:00</lastUpdated>
</ClientApplicationInfo>
<?/appStart>
|
TestUABUpdater.exe.config
This file will have several sections that you will add. The configSection defines the AppUpdater Block. Strings colored Red are strings that must be changed to your settings.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="appUpdater" type=
"Microsoft.ApplicationBlocks.ApplicationUpdater.UpdaterSectionHandler
,Microsoft.ApplicationBlocks.ApplicationUpdater" />
</configSections>
| The appSettings section defines the version number for the current app in the old version. In this file, for the new version, the version number is updated to "2.0.0.0", for example. How you want to version your app is up to you, but this is the key that the Upadate will look for to determine if the version is new.
Next, define the AppUpdater section. The Modulus and Exponent come from the PublicKey.XML file created by the Manifest Utility, Generate Key menu option.
<appSettings>
<add key="version" value="1.0.0.0" />
</appSettings>
<appUpdater>
<UpdaterConfiguration>
<polling type="Seconds" value="300" />
<logListener logPath="C:\Self Updating Application\DemoApp\UpdaterLog.txt" />
<!-- **************** BITS DOWNLOADER **************** -->
<downloader type= "Microsoft.ApplicationBlocks.ApplicationUpdater.Downloaders.BITSDownloader"
assembly= "Microsoft.ApplicationBlocks.ApplicationUpdater,Version=1.0.0.0,Culture=neutral,
PublicKeyToken=null" />
<!-- **************** THE RSA KEY HASHING VALIDATOR **************** -->
<validator type=
"Microsoft.ApplicationBlocks.ApplicationUpdater.Validators.RSAValidator"
assembly="Microsoft.ApplicationBlocks.ApplicationUpdater,Version=
1.0.0.0,Culture=neutral,PublicKeyToken=null">
<key>
<RSAKeyValue>
<Modulus>qXPF9B+owlrD18yA2y8ZhURqH7+hDONsUqN2obJqtTi
Fhk5nUidPBW/LfoKKFM6U5dr2RxjH8eUDSWzRCc4XYOr46g
Dfzx2zwNcX0etJmqAsFQQWb8a5arOjkBuQX2jpY0CuV42zjC+
elCTmMI/MlYl+PRNkshmQ7vkY9b+vkr0=</Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>
</key>
</validator>
<application name="TestUABSelfUpdater" useValidation="true">
<client>
<baseDir>C:\Self Updating Application\DemoApp</baseDir>
<xmlFile>C:\Self Updating Application\DemoApp\AppStart.exe.config</xmlFile>
<tempDir>C:\Self Updating Application\DemoApp\temp
</client> |
Note that the xmlFile must point to the server URL. Insure that this is the case or the Downloader will not work!
<server>
<xmlFile>http://localhost/AppUpdates/ServerManifest.xml</xmlFile>
<xmlFileDest>C:\Self Updating Application\DemoApp\ServerManifest.xml</xmlFileDest>
<maxWaitXmlFile>60000</maxWaitXmlFile>
</server>
</application>
</UpdaterConfiguration>
</appUpdater>
</configuration>
|
Create The ServerManifest.XML File
Use the Manifest Utility that comes with the Application Block to create your ServerManifest.xml. Clicking on the Manifest Utility link will show you a Utility Dialog that matches the files and directories described in this article. Make sure that you point to the new files to be downloaded in a update directory, not the virtual directory. Save the ServerManifest.xml in the virtual directory. Then, copy the files to be downloaded to your virtual or server directory. Do not change anything in any of these files after the Manifest is created, or they will not validate!
Running the Test and Wrapper DLL for the Application Block
See the article on the Wrapper DLL for code and details for running the test of the Self Updating Application Test.
|
|