Closed JusterWork closed 5 months ago
It is a tricky one.
Host?.Runtime.InstallDir
can only be reliably assessed when the msi session is in progress. And ExitDialog is the first dialog that is displayed after the session is terminated.
So what you can do is store the InstallDir value in some repository that lives in the same process with the dialogs. And then you can read this value in the exit dialog. Mind you that the convoluted MSI runtime model is ridiculously old thus every single custom action is executed in a separate process.
Though I would encourage you to consider moving out the action that you are trying to do from the ExitDialog to the msi AfterInstall event (custom action). If it fits your deployment scenario. Then you do not need to do anything. The even arg already has a proper installdir (either default or changed). And the event itself is already elevated.
oleg, thank you
If I don't manually re-select the InstallDirPath directory in the InstallDirDialog interface, accessing "Host?.Runtime.InstallDir" in the InstallExitDialog interface will have no value.
I am using wixsharp-wix.WPF2.1.2, and the problem occurs in the dialog provided by the project template.