Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute Wix custom action after installation?

Tags:

action

wix

I am using Wix3 to install WCF service to IIS.

How can I use my custom action (c#) function after installation completed? i.e. I need to open installed web.config file and replace hostname with real one.

Any ideas?

like image 363
ZedZip Avatar asked May 18 '11 11:05

ZedZip


People also ask

Where do custom action execute?

Because a custom action can be scheduled in both the UI and execute sequence tables, and can be executed either in the service or client process, a custom action can potentially execute multiple times. Note that the installer: Executes actions in a sequence table immediately by default.


3 Answers

You can schedule it after InstallFinalize action in InstallExecuteSequence.

like image 56
rmrrm Avatar answered Oct 23 '22 16:10

rmrrm


There is a sequence of Actions in Windows Installer. The WiX tutorial has a good section on events (and is a great resource anyway).

A typical example of getting something to run after InstallFinalize is to get the installed app to start.

<InstallExecuteSequence>
   <Custom Action='LaunchFile' After='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>
like image 43
Peter Kelly Avatar answered Oct 23 '22 14:10

Peter Kelly


Why would you:

1) Need a custom action? 2) Do it after the install instead of during the install?

WiX has a built-in extension for handling what you are trying to do:

XmlFile Element (Util Extension)

It will update your XML after the file has been installed and handle rollback scenarios as well.

What you will have to write a CA for though is reading the XML value back into a property ti handle repair and upgrade situations. Read:

The WiX toolset's "Remember Property" pattern.

like image 23
Christopher Painter Avatar answered Oct 23 '22 14:10

Christopher Painter