Publish events

In the following sections, we'll take a look at several events that you can publish. This should give you a good idea about how the Publish element works.

DoAction

The DoAction event calls a custom action that you've declared elsewhere in your markup. For example, suppose we'd defined a custom action called CA_ShowMessage that simply displays a message box with the text You clicked?:

<CustomAction Id="CA_ShowMessage"
              Script="vbscript" 
              Execute="immediate">
   <![CDATA[msgbox "You clicked?"]]>
</CustomAction>

We could then trigger this action with a PushButton by publishing the DoAction event with a value of CA_ShowMessage.

<Control Id="DoActionButton" Type="PushButton" X="120" Y="100" Width="56" Height="17" Text="Click Me!"> <Publish Event="DoAction" ...

Get WiX 3.6: A Developer's Guide to Windows Installer XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.