Dialogs read values from the UI session. If the custom action runs in the
InstallUISequence then the properties will be available. If the custom
action runs in the InstallExecuteSequence, then those properties will not be
available to the dialogs, since properties only flow from the UI to the
Execute sequence (and only a subset of the properties, at that).

If the App.Config file comes from your application, it would be more typical
to read those values in your build and set them in the MSI as default
property values which you would then show to the User before the
InstallExecuteSequence even begins. If the file is present already (because
you are upgrading or modifying) you could read the resident App.Config file
in a custom action in the UI sequence and change the properties to what you
found as your new "defaults". Then you can write them to the App.Config
inside of the install sequence between InstallInitialize and
InstallFinalize.

-----Original Message-----
From: Jeremy Rimer [mailto:jeremyri...@gmail.com] 
Sent: Monday, July 12, 2010 2:19 PM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Persisting Session Variables set in external Custom
Actions to Dialog Input defaults?

I am new to WIX and have been tasked with creating an installer that does
the following:

*Deploys a build of our application without overwriting the App.Config file
for the application

*Loads the key/values in the App.Config file and prompts the user with the
"defaults" (existing values) and allows them to modify them before finishing

*SAVES the values the user provided (or defaults if the user made no
changes) back to the App.Config file for use with the application.

I've got the WIX dilalogs and custom actions laid out successfully where
after InstallFinalize, my "LoadDefaultOptions" CustomAction is executed,
which successfully takes the installation directory and the app config file
name, loads it in an XML reader, and parses the key/value pairs, setting
them into the session variable in this manner:

session[key.toUpper()] = value;

My custom action(s) are defined as:

<CustomAction Id="LoadDefaultOptions" Return="asyncWait"
Execute="immediate" BinaryKey="aeserverDbDialogPackage.dll"
DllEntry="LoadDefaultOptions"/>
<CustomAction Id="SetConfigOptions" Return="check" Execute="immediate"
BinaryKey="aeserverDbDialogPackage.dll" DllEntry="SetConfigOptions"/>

The LoadDefaultOptions executes as such:

<Custom Action="LoadDefaultOptions" After="InstallFinalize" />

I have the custom dialog edit properties set like this:

<Control Id="CCPDbConnString" Type="Edit" X="20" Y="62" Width="150"
Height="18" Property="CCPCONNECTIONSTRING" Indirect="no" />

There's a matching Property tag earlier in the WXS file like this:

<Property Id="CCPCONNECTIONSTRING" Secure="yes" ></Property>

...And the LoadDefaultOptions customAction overwrites the session var like
this:

session["CCPCONNECTIONSTRING"] = <value parsed from file>;

According to session logs, this works as expected, the xml parse works, and
the session vars are set.

My problem is when my custom dialog comes around to prompt the user with
those stored defaults AFTER the LoadDefaultOptions CustomAction has run. The
ORIGINAL property values of the session variables seem to have "stuck"
instead of being overwritten by the custom action that loaded the defaults
via the xml file and stored them in the session. (they are blank as their
original properties are defined, or in the case I define them otherwise,
they show those values instead of the session written values)

How do you get Dialogs to "read" overridden session variables by
CustomActions?

Ultimately I want to load those values from the app config, prompt them back
to the user in an optional dialog prompt off the exit screen (which works so
far, aside from not getting updated session vars), and then on command from
that prompt dialog, run another custom action to re-write the App.Config
file with the settings provided from the custom dialog...

I just can't get the session vars to PERSIST!!!

Any ideas? am I completely off base attempting to use the session in this
manner? how else could I parse the app.config file, and allow an
installation user to change app settings if not by session?
----------------------------------------------------------------------------
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to