I am attempting to pass information in and out of a C# Custom Action, and am 
having a hell of a time with it.

The problem I am attempting to solve is this:
There is a system XML configuration file on my target system.  The path to the 
file is always known.  I need to look into this file and determine whether or 
not a specific element/attribute exists.  If it does exist, I need to recover 
its value and pass it back into the installer for later use.  If it does not 
exist, I need to return some sort of indication so that I write it using an 
util:XmlConfig action.  The actual XML manipulations are the easy part.  The 
problematic is passing the information in and out of the CA.

I have found that if I use a Deferred custom action, I can take a value entered 
in via the UI (file path, Xpath statement, etc) and use it in my CA without 
issue.  I have not been able to pass anything back to the installer though 
(whether or not the element exists).

I have also found that if I use an immediate action, I then have access to the 
session object, which includes the Database object.  Unfortunately, the 
Database object only includes what is in the database at the beginning of the 
install, and not what may have been modified during the UI Sequence.  I have 
used a MessageBox within the CA to show me what value lies in the property when 
the CA executes, and extra UI Dialogs to examine the property after it has been 
modified.  I am able to modify the property via the UI and have it visible to 
the later UI Dialogs.  However, when I examine the property via the Database 
object in the CA, it always contains the default value, even if I pass 
something else in via the command line.

The reason for using the CA in this case is because Wix does not have any 
ability to read files and react to the information found therein.

Is there any way to accomplish my goal here in an elegant and reusable way?  I 
wish it was as easy as creating some kind of parameterized call to a dll with 
some kind of expected return value that would show up in some property...

If code samples of what I've done so far are needed, I can supply that.

Thanks,
David
------------------------------------------------------------------------------
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

Reply via email to