To understand custom actions, you have to also understand sequences. An installation starts with a User Interface sequence where data is collected from the user, but nothing is changed on the target system. It then moves to the Execute sequence where there are no UI elements, but changes are made to the target system through various types of actions. So, what is an action?
Since Windows Installer installations are not controlled by a script (like InstallScript installations), there needed to be a way for developers to control the logic of an installation. This is facilitated by providing a set of standard and custom actions. An action in a Windows Installer installation is like a function in a program.
Now, actions are arranged in sequences, and sequences tell the Windows Installer the order to which actions are to be executed. The Custom Actions and Sequences view shows the sequences in an installation project. Next, we have to understand the types of Windows Installer installations.
There are three types of Windows Installer installations. There is Installation, Advertisement, and Administrative. In an Installation installation, the sequence is executed during a normal installation. In an Advertisement installation, the availability of an application is advertised, but not installed until requested. In an Administrative installation, an uncompressed source image of an application is created on a network. It's similar to the source image on a CD-ROM. Users can then install the product from this source.
The Installation and Administration installations both have User Interface and Execute sequences, but the Advertisement installation only has an execute sequence. But, let's get back to actions.
There are several types of actions. There is the Immediate action, Deferred action, Rollback action, and Commit action. Here are the differences.
An Immediate action is executed immediately and does not odify the target system, because there would be no rollback operations that can undo the changes.
A Deferred action will not be executed immediately when encountered but deferred to the installation script. Typical Deferred actions install files, modify the registry, etc.
A Rollback action is a special type of Deferred action. When the Windows Installer generates is script, it simultaneously generates a rollback script. The rollback script contains operations to be performed when the installation is rolled back. With custom actions, it is the developer's responsibility to provide a method to rollback system changes, since the Windows Installer would know nothing about the custom action.
A Commit action is a type of deferred action which is a complement to a rollback action. Commit actions are only executed at the end of a successful installation. There are placed in the installation script, but not executed until the end.
There is a lot more to all of this, but you have enough information to understand about custom actions. Custom Actions are simply a way to integrate custom code and data into a Windows Installer installation. Because after all, the Windows Installer is not all things to all people. It will probably not provide everything you need to do your installation. So, custom actions are a way to customize the installation for your own needs.
What's nice is that there are many types of custom actions. For example, you can create a custom action that just sets a property. Other types of custom actions are similar to functions, and can be written in VBScript or InstallScript. Also, new to InstallShield 2009 is the ability to write Managed Code Custom Actions. You can now write custom actions in your favorite language, C#, VB.NET, or something else. Very convenient.
No comments:
Post a Comment