The Updater Application Block provides a post-processing architecture that allows developers to create a post-processor after successful upgrade. The post-processor implements the IPostProcessor interface.. Net class, which is used to execute one-time post-installation tasks, such as writing data to the Registry, creating a message queue, or other tasks that cannot be completed by simply copying application files.
The post-processor architecture is shown in Figure 1.
Figure 1 shows the following post-processing steps:
1. The set containing the post-processor is stored in the downloaded file as part of the upgrade.
2. The set, type, and file name of the Post-processor are specified in manifest.
3. After verification, copy the files to their target directory. The application installer calls the Call method to start the processor after startup.
IPostProcessor Interface Design
The IPostProcessor interface must be implemented through all customized post-processors. The following sections describe the IPostProcessor interface:
Problem description
Design goals, trade-offs, and problems
Solution description
Implementation
Problem description
The Application Designer can execute the post-processor created by the developer to execute the post-installation task of the specified application. To implement this function, all post-processors must implement a common interface.
Design goals, trade-offs, and problems
The Updater Application Block developer identifies the following design goals, trade-offs, and problems related to the IPostProcessor interface:
1. The main design goal of the IPostProcessor interface is that it should be simple enough.
2. The major trade-off involves the need for a simple interface and the ability of this interface to provide developers with the ability to use the processor after complex initialization parameters are created. Finally, a simple method is selected.
3. if complex initialization parameters are required, the developer must include the initialization file (such as an xml file containing necessary data) in the upgrade file, and implement code for loading and reading files in the Post-processor.
Solution description
The IPostProcessor interface exposes a Run method.
Implementation
VB. NET
Public interface IPostProcessor: IDisposable
{
Void Run ();
}
C #
Public Interface IPostProcessorInterface IPostProcessor
Inherits IDisposable
Sub Run ()
End Interface
Note: Because IPostProcessor is derived from the IDisposable interface, developers must implement the IDisposable interface while implementing the IPostProcessor interface.
You must also note that the application installer executes the post-processor on a single thread and does not have the ability to throw exceptions or clear used resources. The customized post-processor implementation should ensure that the Dispose method is called after the Run method is completed, or is called after an early exit. The developer must also confirm that all exceptions, including thread suspension, can be handled and can be recorded if necessary.