>> maybe I'm missing something but the constructor choices for the 
>> CustomActionData class could probably be a little better. The 
>> CustomActionData property is always `CustomActionData` so maybe there should 
>> be an overload that takes the session class as an argument and automatically 
>> gets the CustomActionData property.

I guess you missed it. From a deferred CA, the session.CustomActionData 
property will get that data more easily.

However I think Phil's question was not about passing data from immediate to 
deferred, hence my other reply.

-Jason-

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christopher 
Painter
Sent: Monday, June 16, 2008 4:46 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] DTF: Saving data in deffered custom action

If you wire up an installer class CA in VDPROJ and edit the resultant MSI in 
Orca you'll see that you are actually getting 2 CA's for each CA.   Was is a 
Type 51 CA that's setting a property with the same name as the second deferred 
CA.   This is the serialization of properties that the installcontext is 
deserializing for you.

So for DTF, whether it's WiX or InstallShield or whatever,  you need an 
immeadiate CA that serializes and sets the property that will become 
CustomActionData and then in your deferred CA you need to deserialize it.

The serialization looks something like this: ( shoot from hip coding, not 
tested )

            CustomActionData cad = new CustomActionData();
            cad.Add( new KeyValuePair<"PROPA","VALUEA");
            session["DeferredCustomActionName"] = cad.ToString();

The deserialization looks something like this:

            CustomActionData cad = new 
CustomActionData(session["CustomActionData"]);
            string valuea = cad["PROPA"];

BTW, in case Jason is reading, maybe I'm missing something but the constructor 
choices for the CustomActionData class could probably be a little better.  The 
CustomActionData property is always `CustomActionData` so maybe there should be 
an overload that takes the session class as an argument and automatically gets 
the CustomActionData property.

I hope that helps.

Regards,
Chris


Christopher Painter, Author of Deployment Engineering Blog
Have a hot tip, know a secret or read a really good thread that deserves 
attention? E-Mail Me


--- On Mon, 6/16/08, Phil H <[EMAIL PROTECTED]> wrote:

> From: Phil H <[EMAIL PROTECTED]>
> Subject: [WiX-users]  DTF: Saving data in deffered custom action
> To: [email protected]
> Date: Monday, June 16, 2008, 6:34 PM
> I have inherited some WIX code (ie I am a newbie) and have
> moved the managed
> custom action over to DTF (which is very nice BTW).
>
> Previously the CA did something along these lines:
>
> public class MyInstaller :
> System.Configuration.Install.Installer
> {
>       public override void
> Install(System.Collections.IDictionary stateSaver)
>       {
>               base.Install (stateSaver);
>               stateSaver.Add(SS_KEY_INSTALLED_PROFILE, AddProfile());
>               :
>       }
>
>       public override void
> Uninstall(System.Collections.IDictionary savedState)
>       {
>               :
>               bool didInstallProfile =
> (bool)savedState[SS_KEY_INSTALLED_PROFILE];
>               :
>       }
> }
>
>
> Using DTF how can I store a value during the install that I
> can retrieve in
> the uninstall? Note that I am using a deferred custom
> action so the Database
> etc properties of the DTF Session object aren't
> available.
>
> Out of hope I tried session.CustomActionData but that
> doesn't seem to
> persist.
>
> TIA,
>
> Phil
>


-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to