Re: [WiX-users] FW: passing parameters through custom actions in C#
Very good points. I use the bootstrapper approach along with AppSearch and custom logic to make sure that the dependencies are still available during subsequent transactions. While MSI 4.5 should do a better job of addressing the cross-package dependencies issue, the MSI team has expressed no interest in providing MC CA support in future releases. Personally I feel that this is a huge mistake on their part and I know I'm not alone in thinking this.The .NET Framework is simply too important and powerful to be ignored. The aging ( yet important ) MSI api/service should play well ith .NET or it risks being rendered to the heap of legacy one day. [EMAIL PROTECTED] wrote: v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} st1\:*{behavior:url(#default#ieooui) }Thanks for the clarification. (As I have mentioned previously on this list, I personally do my best to steer clear from *all* non Microsoft Custom Actions and was unaware of the special CustomActionData property.) I would agree that unless you are familiar with the quirks C# is much easier to write in. (In fact its what I use every day, and what I would probably use for preference in most situations). Perhaps it is a case of group-think, to say avoid managed code custom actions, but I understand the reasons behind it having suffered (long before Windows Installer or the .NET framework came along) with a scenario where an update to a third party product rendered ours impossible to uninstall or update. Had there not been the dependency *during the installation* on a third party component shared by both products then fixing things would have been much easier. Of course, many choices made when creating an installation can vary depending on the customer(s) you are developing for. If it is an in-house product, or one sold into a situation where good software management is in place, and you know that a specific version of the framework will be present then by all means use managed code custom actions. Similarly if you use a bootstrapper which makes sure the correct framework version is present and being used it is much less likely that you will have problems. As with all best practices, as long as you understand the potential risks it may sometimes be more appropriate to choose not to follow them to the letter. The main reason for reiterating the group-think is to try and help others not to fall into the same type of nightmare scenario I have experienced in the past. Personally, I hope that MS eventually sorts out the problems with managed code custom actions and makes this discussion irrelevant. Regards, Richard - From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christopher Painter Sent: Thursday, August 02, 2007 10:32 AM To: Foster, Richard - PAL; [EMAIL PROTECTED]; wix-users@lists.sourceforge.net Subject: Re: [WiX-users] FW: passing parameters through custom actions in C# `Group Think` may agree that managed code custom actions are bad, but I certainly don't agree. Writing CA's in C++ compared to C# frankly, is painful at best. I've done much research in this area and while I will certainly agree that Installer Class CA's ( InstallUtil) suck, managed code in general does not have to suck. If adding the CA to the install in itself created the framework dependency, I'd say that's an issue but many, many shops these days are doing .NET development so the odds are the dependency is already there. Also the CustomActionData property maps to a property of the same name as the custom action. So if the deferred CA's name is `testing` then the immeadiate CA should set a property called `testing`. - * 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. Downlo
Re: [WiX-users] FW: passing parameters through custom actions in C#
Thanks for the clarification. (As I have mentioned previously on this list, I personally do my best to steer clear from *all* non Microsoft Custom Actions and was unaware of the special CustomActionData property.) I would agree that unless you are familiar with the quirks C# is much easier to write in. (In fact it's what I use every day, and what I would probably use for preference in most situations). Perhaps it is a case of group-think, to say "avoid managed code custom actions", but I understand the reasons behind it having suffered (long before Windows Installer or the .NET framework came along) with a scenario where an update to a third party product rendered ours impossible to uninstall or update. Had there not been the dependency *during the installation* on a third party component shared by both products then fixing things would have been much easier. Of course, many choices made when creating an installation can vary depending on the customer(s) you are developing for. If it is an in-house product, or one sold into a situation where good software management is in place, and you know that a specific version of the framework will be present then by all means use managed code custom actions. Similarly if you use a bootstrapper which makes sure the correct framework version is present and being used it is much less likely that you will have problems. As with all "best practices", as long as you understand the potential risks it may sometimes be more appropriate to choose not to follow them to the letter. The main reason for reiterating the group-think is to try and help others not to fall into the same type of nightmare scenario I have experienced in the past. Personally, I hope that MS eventually sorts out the problems with managed code custom actions and makes this discussion irrelevant. Regards, Richard From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christopher Painter Sent: Thursday, August 02, 2007 10:32 AM To: Foster, Richard - PAL; [EMAIL PROTECTED]; wix-users@lists.sourceforge.net Subject: Re: [WiX-users] FW: passing parameters through custom actions in C# `Group Think` may agree that managed code custom actions are bad, but I certainly don't agree. Writing CA's in C++ compared to C# frankly, is painful at best. I've done much research in this area and while I will certainly agree that Installer Class CA's ( InstallUtil) suck, managed code in general does not have to suck. If adding the CA to the install in itself created the framework dependency, I'd say that's an issue but many, many shops these days are doing .NET development so the odds are the dependency is already there. Also the CustomActionData property maps to a property of the same name as the custom action. So if the deferred CA's name is `testing` then the immeadiate CA should set a property called `testing`. * 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
Re: [WiX-users] FW: passing parameters through custom actions in C#
`Group Think` may agree that managed code custom actions are bad, but I certainly don't agree. Writing CA's in C++ compared to C# frankly, is painful at best. I've done much research in this area and while I will certainly agree that Installer Class CA's ( InstallUtil) suck, managed code in general does not have to suck. If adding the CA to the install in itself created the framework dependency, I'd say that's an issue but many, many shops these days are doing .NET development so the odds are the dependency is already there. Also the CustomActionData property maps to a property of the same name as the custom action. So if the deferred CA's name is `testing` then the immeadiate CA should set a property called `testing`. [EMAIL PROTECTED] wrote: v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} 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. J I dont 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: 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-u
Re: [WiX-users] FW: passing parameters through custom actions in C#
Hi Richard, Thank you. I will do so. My current problem with the code is resolved. I have set the property execute = "deferred" and the code started working properly. Thank you, Regards Balaji. _ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, August 02, 2007 6:11 PM To: [EMAIL PROTECTED]; wix-users@lists.sourceforge.net Subject: RE: [WiX-users] FW: passing parameters through custom actions in C# 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: 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. 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. - 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
Re: [WiX-users] FW: passing parameters through custom actions in C#
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: 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
[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: 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. - 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