Session variables etc.

Jun 2, 2015 at 2:10 PM
I'am have a custom managed function where I would like to know the value of "WixUI_InstallMode". When I ask for that I get "cannot access session details from a non-immediate custom action". Can anyone explain me why - is there a work around ? Where can I find some information about the Wix (MSI) programming model ?

Regards

Finn
Jun 3, 2015 at 6:36 AM
I assume you are trying to access session properties from the deferred action. It requires a special technique due to the MSI limitations. Read about it here: https://wixsharp.codeplex.com/wikipage?title=Deployment%20scenarios#_deferred_actions
Jun 3, 2015 at 8:48 AM
Hi

Still I don't get it.

I try to access the property "WixUI_InstallMode" (which I can see being set in the logfile when running in mondo mode) - but it's empty.

I define my managed action like the following (it becomes elevated and by that deferred as I understand it)

, new ManagedAction(@"OnPreInstall", Return.check, When.After, Step.InstallInitialize, Condition.NOT_BeingRemoved)
{
         UsesProperties = "D_WixUI_InstallMode=[WixUI_InstallMode], EVENTLOGNAME=[EVENTLOGNAME], INSTALLDIR=[INSTALLDIR], VERSION=[VERSION],        PRODUCTNAME=[PRODUCTNAME], PRODUCTEXECONFIG=[PRODUCTEXECONFIG], TPCSERVERURL=[TPCSERVERURL], VCPAGENTURL=[VCPAGENTURL], LOCALE=[LOCALE]"
}

No matter what the "D_WixUI_InstallMode" or WixUI_InstallMode is empty - I can accesse all other defined (my own) properties.

What is the rigth way to access variables like WixUI_InstallMode, LicenceAccepted etc.
Jun 3, 2015 at 8:58 AM
OK, if you can access your variables then you are NOT in differed action. Deferred action cannot access any property at all. That is why you need to push it into customData.

Then most likely you are accessing the property using invalid name. From my memory it might be "InstallMode" not "WixUI_InstallMode".