Only deferred custom actions use the CustomActionData class.  Immeadiate 
Custom Actions can access properties directly:


var installLocation = session["INSTALLLOCATION"];


Here is what I consider `required` reading on the subject:


http://www.installsite.org/pages/en/isnews/200108/index.htm

----------------------------------------

From: "k.koteswararao" <k...@metricasystems.com>

Sent: Wednesday, March 28, 2012 11:58 PM

To: wix-users@lists.sourceforge.net

Subject: [WiX-users] help: Parameters are not passing to custom actions 
when push button clicked?


Hi every one, 

Aim trying to execute c# custom actions but problem is parameters are not

passing to code. Here my code 


<Binary Id="myAction" SourceFile="MyCustomAction1.CA.dll" />


<CustomAction Id="SetCustomActionDataValue" Return="check" 

Property="myActionId"

Value="INSTALLLOCATION=[ProductName];AnotherValue='Just a value'" />


<CustomAction Id="myActionId"  BinaryKey="myAction" 

DllEntry="MySimpleAction"

Return="ignore" Execute="immediate"  />


<InstallExecuteSequence>

<Custom Action="SetCustomActionDataValue" Before="myActionId" >NOT

Installed</Custom>      

<Custom Action="myActionId" Before="InstallFinalize">NOT

Installed</Custom>


</InstallExecuteSequence>


Form UI iam calling  the custom action  code 

Here the code 


<Control Id="btnCheckConnection" Type="PushButton" Height="17" Width="56"

X="304" Y="213" Text="Test">

<Publish Event='DoAction' Value='myActionId' Order="1" >1</Publish>

</Control>


My C#code 


[CustomAction] 

public static ActionResult MySimpleAction(Session session) 

{ 


try 

{ 


session.Message(InstallMessage.Warning, 

new Record(new string[] 

{ 

string.Format("INSTALLLOCATION{0}",

session.CustomActionData["INSTALLLOCATION"]) 

})); 


session.Message(InstallMessage.Warning, 

new Record(new string[] 

{ 

string.Format("Another Value{0}",

session.CustomActionData["AnotherValue"]) 

})); 

//MessageBox.Show(Pid); 

} 

catch (Exception exception) 

{ 

session.Log(exception.ToString()); 

return ActionResult.Failure; 

} 

finally 

{ 


} 

return ActionResult.Success; 

} 


Any wrong that code? 


Thanks


Pallapothu


----------------------------------------------------------------------------
--

This SF email is sponsosred by:

Try Windows Azure free for 90 days Click Here 

http://p.sf.net/sfu/sfd2d-msazure

_______________________________________________

WiX-users mailing list

WiX-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to