Hi Prasad,
If your custom action is of
immediately one, then you don't have to pass installer properties through the
CustomActionData property. In the
immediately custom actions you can retrieve installer properties as explain in the
Retrieving and setting properties article.
Indeed, if the custom action is of
deferred type, then you can pass installer properties through the
CustomActionData property. For details, please check the
Pass installer properties in deferred custom action article.
To pass multiple properties, you can add them as following:
- ActionData InstallerProps.png (12.08KiB)Viewed 11281 times
To retrieve the CustomActionData, you can use the following statement:
Code: Select all
string aCustomActionData = session.CustomActionData.ToString();
Please note that the
aCustomActionData string will contain both
ProductName and
ProductVersion values separated by comma.
e.g.
- MsgBox ActionData.png (13.69KiB)Viewed 11281 times
Here's the full code of my sample custom action:
Code: Select all
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Deployment.WindowsInstaller;
using System.Windows.Forms;
namespace DeferredCA_SampleProj
{
public class CustomActions
{
[CustomAction]
public static ActionResult aDeferredCustomAction(Session session)
{
try
{
session.Log("Begin aDeferredCustomAction");
// retrieving the value of the CustomActionData property
string aCustomActionData = session.CustomActionData.ToString();
MessageBox.Show("aCustomActionData sting contains: \n\n" + aCustomActionData, "Action Data Value");
session.Log("End aDeferredCustomAction");
}
catch (Exception ex)
{
session.Log("Error in custom action aDeferredCustomAction {0}", ex.ToString());
return ActionResult.Failure;
}
return ActionResult.Success;
}
}
}
If you have other questions, please let me know.
Best regards,
Dan