Sasha
Sasha

Reputation: 8860

Can I ensure components installation order?

I'm considering implementing DB upgrades using WiX installer. So there would be few components with SqlScript elements. But I'm not sure if I can rely on the component execution sequence.

Does WiX always add components to MSI Components table in order they are defined in a Fragment? And does Windows installer guarantee to execute them in the order of Components table?

Upvotes: 2

Views: 1943

Answers (1)

Christopher Painter
Christopher Painter

Reputation: 55601

No, MSI does not process components in any given order. It's non-deterministic. However, the SQL Scripts Custom Actions provided by WiX do process scripts in a given order. It's determined by the SqlScript@Sequence attribute.

When the CustomActions evaluate it'll decide which scripts need to be executed based on which components are being installed. It'll then sort that result based on the Sequence attribute and schedule it for installation.

I tend to use things like 100 200 300 400 based on catagories of installation.

100 - Create Empty Databases

200 - Create Tables

300 - Apply Constraints

400 - Load Data

500 - Create objects like procs and triggers

The idea is you don't have to micromanage 101 vs 102 but rather just treat it as stages of installation.

Upvotes: 3

Related Questions