9

In deferred ( with impoersonate = no) to send the Value to the WIX to CA, i am using set property and value

and collecting the data in CA using session.CustomActionData["key"];

Is there any way to send back the data to the WIX from CA

<Property Id="RESTART" Secure="yes" Value="false" />

In immediate i was using,

session["RESTART"] = "true" 

... how to achieve this in deferred CA

asvignesh
  • 787
  • 2
  • 6
  • 32
  • This seems pretty thorough to me: https://stackoverflow.com/questions/11233267/how-to-pass-customactiondata-to-a-customaction-using-wix – PhilDW Aug 07 '17 at 18:01
  • my question is the reverse of that, I want from CA to WIX XML – asvignesh Aug 08 '17 at 05:48
  • Have you tried writing the value to the registry and reading it back from there? – Stein Åsmul Aug 12 '17 at 11:07
  • Reading this again it really isn't clear what you mean by "sending the value back to WiX". Could you please provide some more detail as to what you are trying to achieve? Perhaps there is a better way to accomplish what you want? – Stein Åsmul Aug 12 '17 at 12:27

2 Answers2

6

You cannot modify the session from a deferred custom action; at that point, MSI is executing its script and there's no session to speak of. So you can't set a property. You need some other mechanism to communicate status. WiX's native library includes the functions WcaDeferredActionRequiresReboot to flag that a reboot is required and WcaDidDeferredActionRequireReboot for an immediate custom action scheduled after InstallFinalize to detect the reboot status.

Bob Arnson
  • 21,377
  • 2
  • 40
  • 47
1

You can add an InstallFinalize immediate custom action, which is positioned after all deferred actions, and there you can reset the bundle's (XML) "RESTART" to whatever you want, because session will be available again.

  • the value restart is true or not can be handled only by that particular method, can't able to pass the value – asvignesh Aug 12 '17 at 09:39
  • 1
    You can set the value on CustomActionData in the deferred action. Then, read this value at InstallFinalize immediate custom action from the same CustomActionData and write it to session["RESTART"]. – Jonathan Monsonego Aug 12 '17 at 12:29
  • 1
    No, immediate mode custom actions after InstallFinalize should never be used. They certainly should not change the system - no immediate mode custom action should, and they will be skipped entirely when the setup is run silently (no GUI). In addition they might trigger permission issues when the setup is run elevated (a regular user runs the setup). At least it did when I tried this years ago - I have never used the construct since. I think there were other problems as well, that I don't recall at the moment. Perhaps try to write to the registry as I mentioned above, and then read back. – Stein Åsmul Aug 12 '17 at 12:30
  • I didn't suggest to change the system in the InstallFinalize immediate action. Just read and write value to the bundle variables. Regarding silent, are you sure that immediate custom actions do not take place during silent deployment? It doesn't make any sense. – Jonathan Monsonego Aug 12 '17 at 12:34
  • I did see the silent problem back in the day, and I definitely saw it when the setup was deployed via a deployment system such as SCCM - but as I said I never tested this again in recent years. I am not set up to test atm, perhaps you can give it a test spin? Test as a regular user with elevated rights (you probably need to set the always run elevated policy in the registry). – Stein Åsmul Aug 12 '17 at 12:46