tags:

views:

31

answers:

2

How can I launch Wix Custom action (from C# .NET CA Lib) before any UI happens ?

A: 

I found a solution. You can add that code to UI.wxs

<Publish Dialog="YOUR_DIALOG" Control="SOME_TEXT" Event="DoAction" Value="CA_NAME" Order="you_order">CONDITION</Publish>
Shar
+1  A: 

I think it is better to control this using 'Sequence' attribute of the Custom element.

If you open your output MSI with Orca, switch to InstallUISequence or InstallExecuteSequence table and sort the records by 'Sequence' column, you'll see the sequence of the actions being executed. So, when scheduling your custom action, you can put the Sequence explicitly:

<Custom Action="YourAction" ... Sequence="49" />

More convenient approach it to use Before/After attributes which are mutually exclusive with Sequence. Just find out the action you'd like your custom action to go before or after, and schedule it appropriately:

<Custom Action="YourAction" ... Before="AnotherAction" />

You should take into account the fact that InstallUISequence might not run (basic UI), so if you'd like your action to run in any case and only once, put the attribute Execute='firstSequence' to the custom action definition:

<CustomAction Id="YourAction" ... Execute="firstSequence" />

Be sure to explore wix.chm and MSDN for more information about custom actions. Hope this helps.

Yan Sklyarenko
hm... that case doesn't work for my project. Can you give an example or sample?
Shar
Ok, I'll update my answer with more info.
Yan Sklyarenko