The [STAThread] attribute only works in a program entry point, like Main(). You'd have to actually make sure the entry point of the custom action is using single threaded apartment mode. I'm not sure if there is an option for this currently.
You may be able to get around it by creating a new thread with the desired apartment state and running the code in the new thread. There may be a better solution, though... ###################################### $_='^#(/||/@[EMAIL PROTECTED]@:^[-['^";@@@\\>])@.". "{)/];)^{";$,+=(++$,);$_.=">&$,";`$_`; -----Original Message----- From: Sandeep Gautam (HCL Technologies Ltd) [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2008 12:03 PM To: General discussion for Windows Installer XML toolset. Subject: [WiX-users] [STATread] custom action Hi , I want to create a Custom action for file selection. For this I am writing c# Ca using System.Windows.Forms.OpenFileDialog. this custom action is working on some machine and on few machines it is giving error "Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it". To remove this error I am writing the below mentioned code: [STAThread] [CustomAction] public static ActionResult CustomAction1(Session session) { // code for open dialog } But still this is not working. Please help me out . Regards Sandeep ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users