lastr2d2
lastr2d2

Reputation: 3968

Custom Action between components

How to make sure a custom action to be triggered between installation of two components?

For example I have some Wix definitions as below:

<Feature Id="ProductFeature" Title="My Installer" Level="1">
  <ComponentGroupRef Id="DatabaseSetup" />
  <ComponentGroupRef Id="DatabaseCleanup" />
</Feature>

<InstallExecuteSequence>
  <Custom Action="RunDatabaseMigration" Before="InstallFinalize"></Custom>
</InstallExecuteSequence>

Is there a way to make sure the custom action RunDatabaseMigration runs right between DatabaseSetup and DatabaseCleanup?

I am expecting something like this but obviously I can only use name of standard or custom action for the Before and After attribute, this solution doesn't applied to component.

<Custom Action="RunDatabaseMigration" After="DatabaseSetup"></Custom>

Upvotes: 2

Views: 652

Answers (1)

zett42
zett42

Reputation: 27766

How to make sure a custom action to be triggered between installation of two components?

In general is not possible to schedule a custom action between two components. As you already found out by yourself, the Before and After attributes have to name a standard or custom action.

Windows installer doesn't install one component after another. Components are just logical groups of installation items, e. g. registry keys, files and so on but they don't define installation order. Instead, Windows installer groups different kind of resources like registry keys and files and installs these groups in the order defined by the InstallExecuteSequence table. For instance, at one point all files will be installed (InstallFiles action) and later on all registry keys will be written (WriteRegistryValues). Have a look at the suggested InstallExecuteSequence to get a better idea.

That being said, if DatabaseSetup only installs one kind of resource (say files) and DatabaseCleanup installs a different kind (say registry keys), you could schedule a custom action between the two associated standard actions (in this case InstallFiles and WriteRegistryValues). But if both components install the same kind of resource or mixed resources, you can't use that workaround. In this case you would have to convert one of the components into a custom action that you could schedule at any point.

Upvotes: 3

Related Questions