Thanks Jason, this gets me most of the way to where I need. Let me see if I understand this correctly:
* I create two <CustomAction> elements in my WiX project, one for the immediate custom action, one for the deferred. * Then, I schedule the immediate custom action using a <Custom> element in my WiX project under the <InstallExecuteSequence> element. * In my C# code for the immediate custom action, I place a session.DoAction() call using the name of my deferred CA in the Id attribute of my <Custom> element. I've tried this with WiX 3.0.4214 and when I attempt to install the resulting .msi, I get an error 2721 ("Custom Action foo not found in the binary table stream") when the installer attempts to schedule the deferred action. Looking in orca, everything looks right in the CustomAction table, but I'm clearly missing something simple here. --Jim -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jason Ginchereau Sent: Friday, June 20, 2008 9:50 AM To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] DTF custom action questions 1. In your <InstallExecuteSequence>, you could schedule your CA relative to the WixSqlExtension CA like this: <Custom Action="MySqlCA" After="InstallSqlData" ... You'll need to do the work in a deferred CA, because the WixSqlExtension CAs do their work in the deferred phase. But it is a common pattern to invoke (schedule) a deferred CA directly from an immediate CA, so in that case you only need to author the immediate CA scheduling in WiX. 2. From an immediate CA, you can read the data from the Binary table into either a Stream or a file: open a View on the Binary table, execute the View, fetch the Record, and then call one of the Record.GetStream() overloads. Then you'll need to pass this data to a deferred CA because an immediate CA should not modify system state and a deferred CA cannot read the MSI database. (And also because it needs to be after the InstallSqlData CA as mentioned above.) To pass that data, fill a CustomActionData object with the data and invoke the deferred CA with session.DoAction(deferredActionName, actionData). Then from within the deferred CA you can access that data as the session.CustomActionData property. Finally, don't forget about rollback and uninstall! 3. A DTF CA DLL is authored in WiX exactly like an unmanaged CA DLL. You need a <Binary> element for the DLL, a <CustomAction> element for each CA entrypoint, and a <Custom Action=...> to sequence each call in <InstallExecuteSequence>. When it comes to the MSI/WiX authoring, there are no additional elements you need to worry about just because the CA is managed or using DTF (other than perhaps a LaunchCondition to verify .NET is available). Hope this helps. -Jason- -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Evans, Jim Sent: Friday, June 20, 2008 4:24 AM To: General discussion for Windows Installer XML toolset. Subject: [WiX-users] DTF custom action questions My installation creates and then interacts with a SQL Server database. Up until now, I've been able to do everything I need to do from WiX using the standard extensions, but now I'm facing a problem for which I need a custom action. I have to import some data into my database, but I need to modify it based on information gathered during the installation. Here are my questions: 1. How can I properly schedule my custom action to ensure it runs after my other SqlScripts and SqlStrings have been run? 2. How can I use data files (stored in the MSI with the <Binary> element*) in my custom action? I don't want to actually install them on the user's machine, just use them during the installation. 3. I'm having a hard time getting my head around how to correctly author and deploy a DTF custom action. Using Votive, I'm able to build the CA assemblies properly, but what do I need to add in my WiX project to make sure all of the elements are available to execute the custom action? DTF.chm has a good enough sample of C# code that I can follow the CA method creation, but can somebody point me to a sample fragment that includes all of the elements necessary to get a DTF CA to run? * I'm not wedded to using them as Binary streams in the MSI; if somebody has a better suggestion, please feel free to chime in. ------------------------------------------------------------------------ - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users