0
votes

I'm new to WIX (Windows Installer XML) and there's something I don't understand.

It seems to me that there is a contradiction between Custom Action and Features: Features are selected by the installing user and are run by an order determined by the programmer. Custom Actions are a nessecary part of this (especially if the installation requires running an external script or EXE), but it seems to me they can't be run as part of a set of features - only before or after all the features are run.

Can you setup a Custom Action to run inside a component? Can you setup a Custom Action to run between two features?

1

1 Answers

1
votes

Nope. Features are logical entities only, designed to give the person installing the product a way to choose which components they desire. Components are closer to "real", but in a sense they only describe which files and registry keys and so forth will be installed. All actual work takes part in actions, whether standard actions or custom actions.

Looking at the InstallExecuteSequence of your built MSI, consider just InstallFiles, WriteRegistryValues, and MyCustomAction. Simplifying a bit, InstallFiles will examine all selected components to determine which files to install, and copy them to their destination. WriteRegistryValues will examine all selected components, and write their registry keys and values. Your custom action can occur before or after either of those actions, but cannot come somewhere in the middle. (Even if it could, the order of operations within InstallFiles and WriteRegistryValues isn't necessarily something you can control.)

By the way, I would guess you ask this question because your scenario seems to require that you execute code that depends on the exact machine state. For instance, you may want to run a self-registration routine with file A present, but file B still missing. This is not the correct approach for Windows Installer. In this example, one should instead identify the registry keys that the self-registration routine would write, and author them. Applying that sort of advice to your actual scenario may be tricky, of course.