Innovative Application Packaging Cloud

Innovative Application Packaging Cloud
Automated Packaging Self-Service (APS) is an innovative cloud solution that provides smart application packaging, testing and documentation.

Tuesday, September 27, 2011

Complete Custom Action Refrence including CA Types,Sequences,Conditions,Scheduling options,Processing options,Inscript options and some examples


Custom Action:

The Microsoft Windows Installer provides many built-in actions for performing the installation process whic are called as standard actions. For some cases the developer writes an action to execute his own installation is called custom action

Types of Custom Actions:

• DLL file stored in a Binary table stream
• DLL file that is installed with a product
• EXE file stored in a Binary table stream
• EXE file that is installed with a product
• Displays a specified error message and returns failure, terminating the installation
• EXE file having a path specified by a property value
• EXE file having a path referencing a directory
• JScript file stored in a Binary table stream
• JScript file that is installed with a product
• JScript text specified by a property value
• JScript text stored in this sequence table
• VBScript file stored in a Binary table stream
• VBScript file that is installed with a product
• VBScript text specified by a property value
• VBScript text stored in this sequence table
• Property set with formatted text
• Directory set with formatted text
• Installation of a package nested inside of the first package.
• Installation of a package that resides in the first application’s source tree.
• Installation of an application that is advertised or already installed.

Types of Sequences in the Custom Actions:

• Normal User Interface
• Normal Execute Immediate / Deferred
• Administrative User Interface
• Administrative Execute Immediate / Deferred

Types of Conditions in the Custom Actions and what is the use(You can execute a custom action or make the component install using conditions as per the requirement):

1. Action run only during Install
Condition: NOT Installed AND NOT PATCH

2. Action only runs during removal of MSI
Condition: REMOVE

3. Action runs during Install and repair
Condition: NOT REMOVE

4. Action runs during Install and remove
Condition: There must be no condition

5. Action calls EXE installed by MSI
Condition:NOT Installed AND NOT PATCH

6. Run on initial installation only:
NOT Installed

7. Run on initial install or when repair is selected.
NOT Installed OR MaintenanceMode="Modify"

8. Run when being uninstalled from command line or add / remove menu.
REMOVE~="All" OR MaintenanceMode="Remove"

 Types of In Script options in the Custom Actions:

a) Immediate Execution
Immediate custom actions, can be sequenced anywhere within any of the sequence tables. It has access to the
installation database (read & set installation properties, modify feature & component states, add temporary
columns, rows, and tables).

b) Deferred Execution – User Context
Deferred custom actions can only be sequenced between the InstallInitialize and InstallFinalize actions in
execute sequence tables. It doesn’t have access to the installation database. Deferred custom actions are not
executed immediately. Instead they are scheduled to run later during the execution script. The execution script
isn't processed until the InstallExecute, InstallExecuteAgain, or InstallFinalize action is run.
If the Current User doesn’t have the elevated privileges (Custom actions make changes in the system directly),
the custom actions should run in Deferred Execution in User Context only.

c) Rollback only
This Action should be executed during the Installation of the Rollback script or if the Installation is Unsuccessful

d) Commit only
This Action should be executed during the Installation of the Commit script.

e) Deferred Execution – System Context
Deferred custom actions can only be sequenced between the InstallInitialize and InstallFinalize actions in
execute sequence tables. It doesn’t have access to the installation database. Deferred custom actions are not
executed immediately. Instead they are scheduled to run later during the execution script. The execution script
isn't processed until the InstallExecute, InstallExecuteAgain, or InstallFinalize action is run.
If the Current User have the elevated privileges (Custom actions make changes in the system directly), then it
should run in Deferred Execution in System Context only.

Difference between “Immediate Execute / Deferred Execute”

.• Immediate custom actions, can be sequenced anywhere within any of the sequence tables

• Deferred custom actions can only be sequenced between the InstallInitialize and InstallFinalize
actions in execute sequence tables
• Immediate custom actions have access to the Installation database
• Deferred custom actions doesn’t have access to the Installation database
• Immediate custom actions can only run in the User Context
• Deferred custom actions can run both in the context of the user and elevated using the system context



Difference between “Deferred in System Context / Deferred in User Context”

If the Custom action which installs or modify a file under the INSTALLDIR or Installation should be run in
“Deferred in User Context”
If the Custom action which installs or modify the system file directly should be run in “Deferred Execution in
System Context”

Types of Processing Options in the Custom Actions

Synchronous: Windows Installer runs the custom action synchronously to the main installation. It waits for the custom action to complete successfully before continuing the main installation
• Synchronous, ignore exit code: Windows Installer runs the custom action synchronously to the main
installation. It waits for the custom action to complete before continuing the main installation; the action
can be either success or fail.

• Asynch, wait at end of sequence: Windows Installer runs the custom action simultaneously with the
main installation. At the end it waits for the exit code from the custom action before continuing.

• Asynch, no wait: Windows Installer runs the custom action simultaneously with the main installation. It
doesn’t wait for completion of the custom action and doesn’t check the exit code also.

Types of Scheduling Options in the Custom Actions

Always Execute: This action execute in all sequences

• Run first time: This action execute only the first time Windows Installer encounters it.

• Run once per process:This action execute only one time either Execute sequence that should not run if
the installation is running in silent mode.
• Run only if UI sequence was run: This action execute only if either Execute sequence is run following
User Interface sequence.

Examples on CA Types

Type 51
 SetProperty (runs before costfinalize only)

Type 35
SetProperty
34->msidbCustomAction TypeDirectory
The Target column is formatted and contains the full path and name of the executable file followed by optional arguments.  (Custom action table)
+
1 ->msidbCustomAction TypeTextData

Type 66
2 -> msidbCustomAction TypeExe(EXE file stored in a Binary table stream.)
[other types are 18(EXE file installed with a product.),
50(EXE file with a path specified by a property value.) and
34(EXE file with a path referencing a directory.)]
+
64 -> msidbCustomAction TypeContinue(Synchronous execution. Ignores exit code and continues)[CA return processing options]

Type 257-
1 > msidbCustomActionTypeDll + msidbCustomActionTypeBinaryData
+
256 -> msidbCustomAction TypeFirstSequence [Execute once if present in both sequence tables. Skips action in execute sequence if UI sequence has run. No effect in UI sequence. Not affected by install service registration.]

Type 1058
34 -> msidbCustomAction TypeDirectory
The Target column is formatted and contains the full path and name of the executable file followed by optional arguments.
+
1024 -> msidbCustomAction TypeInScript
(defered in System Context)

Type 1378
34 - > msidbCustomAction TypeExe
+
64 -> msidbCustomAction TypeContinue
+
1280 -> (msidbCustomAction TypeInScript+msidbCustomAction TypeRollback)

Type 3106
34 ->  msidbCustomAction TypeExe
+
3072 -> msidbCustomAction TypeInScript + msidbCustomAction TypeNOImpersonate(Deffered in User Context)

Type 3138
2 - > msidbCustomAction TypeExe
+
64 -> msidbCustomAction TypeContinue
+
3072 -> (msidbCustomAction TypeInScript+msidbCustomAction TypeNoImpersonate(Deffered in user Context)

Type 3170 
34 - > msidbCustomAction TypeExe
+
64 -> msidbCustomAction TypeContinue
+
3072 -> (msidbCustomAction TypeInScript+msidbCustomAction TypeNoImpersonate(Deffered in User Context)

1 comment:

VIKRAM said...

This is the best description about CA's I have everseen


You rock