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, November 01, 2011

How to get MSI Property in deffered Mode:CustomActionData

1.      As you all are aware a basic MSI installation is driven on the basis of two sequences called as immediate mode and deffered mode.The user interface is generally a immediate mode sequence and the actions specified in between the InstallIntialize and InstallFinalize is a deffered mode.
2.      Windows Installer contains  predefined properties, and an installation author can define custom properties to store any extra data needed at run time. A property can, for example, be set by the user in a dialog box, and then later be written to the registry.Property names are case sensitive. Two classes of MSI properties are public properties
  •  PUBLIC Properties which have names containing only uppercase letters (USERNAME INSTALLDIR,COMPUTERNAME).
  • The values of public properties can be set at the command line, and their values are preserved when execution switches from the User Interface sequence to the Execute sequence.
  •  Private properties, whose names contain at least one lowercase letter (AdminUser and ProgramFilesFolder).
  • Private properties, on the other hand, cannot have their values set at the command line, and are reset to their default values when execution switches from the User Interface sequence to the Execute sequence.
1.       During deffered mode only a handful of properties are accessible Such as ProductCode,UserSID and CustomActionData.
2.      Here we are going to discuss the CustomActionData Property.A CustomActionData Property is to retain value within the deffered phase.
3.      For an example, suppose you have a deferred VBScript custom action called "CallSetup", in which you want to read the value of the SourceDir property. The steps involved in populating this property are the following:

Here we will call the vbscript where we have used the CustomActionData using session property.
  1.  Click on the MSI Script tab and select installation mode as All Custom Actions, then select the option of  Call VBScript From Installation.
  2. In the Call VBScript from Installation menu, under Details tab give a suitable Custom Action Name (Eg: CallVBscript_Installation), then  browse and associate the Vb Script (ie .vbs file) with the Script File option.
  3. Then under the location tab Uncheck No Sequence option and select Sequence as Normal Execute Immediate/Deferred and add the “CallVBscript_Installation” custom action before the InstallFinalize option and position it with the help of Move up or Move down options. Then put the condition as NOT REMOVE~="ALL" (This ensures that the custom action is called only during application installation and repair not during un-installation).
  4. Under the Properties Tab select In-Script Options as Deferred Execution-System Context and select the Processing option as Synchronous, Ignore exit code and click OK.
  5. Then select the Set Property option.
  6.  In Set Property option, under details tab name give a suitable name for the Custom Action (Eg: SetProp_customActionData) and set property as CallVBscript_Installation and property value will be [SourceDir] Note that the property should be same as the VBScript custom action Name.
  7. Then under the location tab Uncheck No Sequence option and select Sequence as Normal Execute Immediate/Deferred and position the SetProp_customActionData custom action after the CostFinalize option with the help of Move up or Move down options.
  8. Under the Properties Tab select  Scheduling Options as Always Execute

If you have any queries or other information do post it here.





1 comment:

pranathichennuru said...

Are you referring to INstallShield 2012 here in this article ?