Execute InstallUISequence with Managed UI

Sep 2, 2015 at 2:49 PM
When I use Managed UI (Embedded UI) actions from sequence InstallUISequence doesn't execute. Is it any way to force execute InstallUISequence with Embedded UI?
Coordinator
Sep 3, 2015 at 10:13 AM
Sorry, I don't have my laptop with me so I cannot check it but if I am not mistaken WiX EmbeddedUI overrides InstallUISerquence. Thus you need to use some alternatives.

Most likely you will find that project.BeforeInsall and project.AfterInstall events will serve you with the same (if not higher) level of flexibility and convenience.
Sep 3, 2015 at 12:31 PM
I'll try to explain my problem. When UI displayed I want to know is it install or update. Also I need some parameter values determined using RegValueProperty. etc

Unfortunately events project.Load, project.BeforeInstall and project.AfterInstall execute in InstallExecute sequence. InstallUI sequence doesn't execute at all. So standard actions AppSearch, FindRelatedProducts, etc from InstallUI sequence doesn't execute. Information listed above I can get only when starts execute InstallExecute sequence, but it's too late.

Maybe exists any ways to execute standard actions manually (AppSearch, FindRelatedProducts, etc)
Coordinator
Sep 3, 2015 at 10:14 PM
The event args parameter contains everything what you need. You can test it to see if you are installing or updating. You also have the whole power of .NET at your disposal. Why do you need to rely on inferior MSI standard actions? For testing registry existence you can use RegistryKey and for files File.Exists. For installed products you also can do it with registry. I am planing to add these tasks in the CommomTasks class in the next release. But they are very simple so you don't have to wait for the next release and probably can implement them by yourself.

Keep in mind that the problem you are experiencing is not a Wix# flaw but a constrain of MSI/WiX. If you don't want or cannot go with my recommendation then you will need to find a canonical WiX solution for the case when EmbeddedUI is used (e.g via explicitly invoking custom actions). And if you find one then bring it to your Wix# definition.

I am on holiday now so I cannot do any experiments but when I am back i will try to prepare a code sample (for the samples library) that reflects your scenario.
Coordinator
Sep 8, 2015 at 4:56 AM
The latest release (v1.0.24.0) contains the AppSearch routines that can be used from the user code. Managed project has also be updated with the extra event that can be used instead of InstallUISequence. The code samples and the documentation has been updated to reflect the changes

Read more about this functionality here.
Sep 9, 2015 at 11:59 AM
Thank you for your help. I've solve my problem using extra code in first dialog. I will check new features. Hope it fits me.
Coordinator
Sep 9, 2015 at 12:07 PM
Yes, the the first dialog is the most obvious (and practical) choice.

The new functionality of the latest release is very similar to your approach as the event is fired just before initializing the first dialog.
It also includes C# equivalent of MSI AppSearch tasks (Directory, File, Registry, Product search) that can be invoked from the user C# code.

Detailed info
Sep 9, 2015 at 1:09 PM
Something wrong with file AppSearch.cs, it is absent in project WixSharp. And when I try to debug, execute AppSearch.GetProductCode() throw out from debuger.
Sep 9, 2015 at 1:15 PM
And in project.UIInitialized event handler SetupEventArgs.ProductName is null.
Sep 9, 2015 at 1:39 PM
Unfortunately new functionality of latest release doesn't solve my problems. Most difficulties that I have occur with major upgrade scenario.

When performed install or upgrade I should check is related product versions installed. Information about current ProdectCode is absent (it is obvious). So using function MsiEnumRelatedProducts and UpgradeCode I get ProdectCodes of related products. Using ProdectCode of related product I can get some information from registry (for instance from Uninstal section).