Baladji,

 

Be very careful using C# within a Microsoft Installer based installation
(like those generated using WiX). By doing so, you place an additional
dependency on the .NET framework, and has been discussed many times this
is a *bad thing*. Ideally you should choose something (e.g. C++) that
can be built to have minimal (ideally no) external dependencies.

 

As far as your code problem is concerned... it appears that you are
setting a property called "testing", but your custom action is
attempting to retrieve one called "CustomActionData". This might cause
trouble. :-) I don't know if what you posted is actually the code you
are using, or if you sanitized it first, but it would be worth checking.

 

Regards,

Richard

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Balaji
Nidadavolu
Sent: Thursday, August 02, 2007 5:40 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] FW: passing parameters through custom actions in C#

 

Hi,

 

I am trying to pass parameters from WIX to C# code, but I am not able to
do it properly. To code that I have written on WIX side is:

 

<Property Id="teststring">

<![CDATA[Hello world]]>

</Property>

<CustomAction Id="testing" Return="check" BinaryKey="test"
DllEntry="hello"/>

<Binary Id="test" src="test.dll" />

<CustomAction Id="testing.setproperty" Return="check" Property="testing"
Value="[teststring]" />

 

<InstallExecuteSequence>

<Custom Action="testing.setproperty" After="InstallFiles" />

<Custom Action="testing" After="testing.setproperty" />

</InstallExecuteSequence>

 

The code I have written in C# and compiled as a DLL is :

 

using System;

using System.Text;

using System.Runtime.InteropServices;

 

namespace testing

{

public class test{

public static int hello(IntPtr handle)

{

int i;

int ptrcnt = 256;

//System.Windows.Forms.MessageBox.Show( String.Format( "Hello World
{0}",handle) );

StringBuilder sb = new StringBuilder(ptrcnt);

i = MsiGetProperty(handle,"CustomActionData",sb,ref ptrcnt);

System.Windows.Forms.MessageBox.Show( String.Format ( "{0}",sb ) ;

 

return 0;

}

[DllImport("msi.dll", CharSet=CharSet.Unicode)]

static extern int MsiGetProperty(IntPtr hInstall, string szName, [Out]
StringBuilder szValueBuf, ref int pchValueBuf);

 

 

}

}

 

But I am not able to pass the property value to C#. I am compiling the
code as a dll and making necessary modifications in the ilcode to export


the method test. Can anyone please let me know if I am missing anything.


 

Thank you,

regards

balaji.

DISCLAIMER ========== This e-mail may contain privileged and
confidential information which is the property of Persistent Systems
Pvt. Ltd. It is intended only for the use of the individual or entity to
which it is addressed. If you are not the intended recipient, you are
not authorized to read, retain, copy, print, distribute or use this
message. If you have received this communication in error, please notify
the sender and delete all copies of this message. Persistent Systems
Pvt. Ltd. does not accept any liability for virus infected mails.




* C O N F I D E N T I A L I T Y N O T I C E *
-----------------------------------------------------------
The content of this e-mail is intended solely for the use of the individual or 
entity to whom it is addressed. If you have received this communication in 
error, be aware that forwarding it, copying it, or in any way disclosing its 
content to any other person, is strictly prohibited. Quixote Traffic 
Corporation is neither liable for the contents, nor for the proper, complete 
and timely transmission of (the information contained in) this communication. 
If you have received this communication in error, please notify the author by 
replying to this e-mail immediately and delete the material from any computer.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to