Versioning Options
Lab Description
Any application update process must consist of three activities.
- Checking for an available update
- Downloading an update
- Initiating the update process (Applying the update)
With AppLife Update, the Update Controller performs these activities for you. We’ll
discuss the first step in the process, determining whether or not an update is available.
To accomplish this, we need a way to identify what version is currently checking
for an update. When you first initialize an Update Controller, its Version
property is used. The version property follows the {Major}.{Minor}.{Build}.{Revision}
format. You can set this property within a form designer or with code.
The Update Controller offers a simple means to synchronize the Update Controller
version property with the hosting application assembly version number. This makes
sense for many applications as this is a natural key for determining the current
application version. To enable this synchronization, simply set the Update Controller
UseHostAssemblyVersion property to true.
For many applications though, setting the version property within the designer or
using the assembly version for determining the current client version is not the
best approach. The primary disadvantage is you actually have to build a new version
of the hosting application just to increment the version stamp. For applications
with sub-components such as data files or databases that require periodic updating,
requiring an application rebuild to publish an update is not the best approach.
Another example is an update process that will actually update multiple sub-applications
at once. In this scenario as well, a different versioning key would be beneficial.
A common alternate approach with AppLife Update is to use a config file entry to
hold the current application version. A registry key or database table could also
be used with a similar approach.
Using a config file entry
To use an entry from a config file to version a client, we need to set the Update
Controller version property before we check for updates and we need to modify the
config file while updating. With AppLife Update, these activities are easily accomplished.
Setting the Client Version
Setting the version on your Update Controller requires one line of code.
//set the
version number from the config file
this.updateController.Version
= new Version(ConfigurationManager.AppSettings["version"]);
Updating the Client Version
Updating the client version during an update requires adding two actions to the
end of your action list update. We’ll use a Set Shared Property action to
place the current update version into a property that we can use in a Change Xml
Node action. With this action we can easily set the version value within the
application config file. With these two actions in place, we can go about publishing
updates that perform any updating actions knowing that proper versioning is in place.
To use a registry key or database to maintain the client version value, you would
use a Set Registry Value or Transacted Database query action in place
of the Change Xml Node action.
Summary
By using a config file to maintain the current client application version, your
updates do not require building and publishing modified application assemblies.
This adds flexibility to your updating process.
Download AppLife Update Here