Deferred custom actions have limited access to the installation session and cannot access the database. For more information, see MSDN: Obtaining Context Information for Deferred Execution Custom Actions <http://msdn.microsoft.com/en-us/library/aa370543.aspx>
-----Original Message----- From: Brian Rogers [mailto:[EMAIL PROTECTED] Sent: Monday, October 13, 2008 1:34 AM To: wix-users@lists.sourceforge.net Subject: [WiX-users] DTF: InstallerException from Session.Database, etc. I'm trying to get a very simple DTF project running. I have a simple WiX project which invokes a DTF managed custom action. However, I can't seem to do anything useful in my custom action before it crashes. It seems that MsiGetActiveDatabase is returning 0 (NULL?) for the handle which results in an InstallerException when getting any property like Database, Components, Features, etc. My entire custom action code looks like this: namespace DtfSample { using System; using Microsoft.Deployment.WindowsInstaller; public static class SampleCustomActions { [CustomAction] public static ActionResult DoStuff(Session session) { session.Log("DoStuff Started"); session.Log("My database file path is '{0}'", session.Database.FilePath ?? "<UNKNOWN>"); return ActionResult.Success; } } } The second line of DoStuff fails with the InstallException I mentioned above. I also have a CustomAction.config which looks like this, as recommended by the documentation: <?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v2.0.50727"/> </startup> </configuration> Here are the relevant portions of the WXS file: <Binary Id="DtfSampleCA" SourceFile="..\DtfSample\bin\Debug\DtfSample.CA.dll" /> <CustomAction Id="DtfSample.DoStuff" BinaryKey="DtfSampleCA" DllEntry="DoStuff" Execute="deferred" Impersonate="no" Return="check" /> <InstallExecuteSequence> <Custom Action="DtfSample.DoStuff" Before="InstallFinalize" /> </InstallExecuteSequence> (I'm also using the WiXUIExtension, but I'm not customizing it or anything.) I'm building this with Visual Studio 2008 SP1 and the managed custom action template which comes with WiX 3.0.4513.0 (I used the 64-bit installer for WiX, if that matters). My system is 64-bit Vista, although my VS projects for both WiX and DTF are set for the x86 platform. I have a feeling my problem is something to do with 64-bit since I know others are using this successfully. In general, it's very hard to tell what I could be doing wrong due to the lack of error information (the exception has no helpful information or error code or anything). I've even tried setting everything to the x64 platform, specifying Platform="x64" in my WXS file, etc. and it fails the same way. What am I doing wrong? ###################################### $_='^#(/||/@[EMAIL PROTECTED]@:^[-['^";@@@\\>])@.". "{)/];)^{";$,+=(++$,);$_.=">&$,";`$_`; ------------------------------------------------------------------------- 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