Take a peek at CurrentSession.GetMode, passing it what you're interested in detecting. InstallRunMode.Scheduled I believe is 'deferred', InstallRunMode.Commit is commit, etc...
For immediate I use InstallRunMode.Operations || InstallRunMode.Maintenance. -----Original Message----- From: Tom Crozier [mailto:tcroz...@rackwise.com] Sent: Friday, July 31, 2009 7:57 AM To: wix-users@lists.sourceforge.net Subject: [WiX-users] Determine if DTF CA called immediate or deferred Is there a way to determine whether a DTF custom action was called via an immediate or deferred action other than a try catch around accessing the inappropriate session data and handling the "Cannot access session details from a non-immediate custom action" exception? The following will throw a System.Reflection.TargetInvocationException "Cannot access session details from a non-immediate custom action" if called from a deferred action. if (session["InvokeTest1"] != null) { // This is an immediate action session.Log("This is an immediate action. Value={0}", session["InvokeTest1"]); } However the following works fine in either an immediate or deferred action CustomActionData cad = session.CustomActionData; if (cad.Count > 0) { session.Log("This is a deferred action with {0} parameters", cad.Count); } So how can I check which type I am being called from instead of handling the exception? I want to create a general purpose action that can be called in either instance and am not sure the best way to do this. {Neil had a good post at: http://blog.deploymentengineering.com/2009/02/msi-tip-how-to-reuse-customaction-for.html on how to reuse a custom action for deferred and rollback operations and I'd like to go one step further} Thanks - TopCat ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users