tags:

views:

232

answers:

1

Is there a way to ensure, either through specifying order or by specifying dependencies, that one component will execute before another in WiX?

Specifically, I'm trying to create a database, then, optionally, run a script on it. My Wix looks similar to this:

<ComponentGroup Id="SQLServerComponentGroup">
    <Component Id="SQLServerIstallScriptWA" Guid="" >
    <Condition>INSTALLDB</Condition>
        <mssql:SqlDatabase Id="dbWA" Server="localhost" Database="[DATABASENAME]" CreateOnInstall="yes" ConfirmOverwrite="yes" DropOnReinstall="no" DropOnUninstall="yes">
            <mssql:SqlScript Id="dbWAScript" ContinueOnError="no" ExecuteOnInstall="yes" ExecuteOnReinstall="no" Sequence="1" BinaryKey="MSSQLCreateDBBin" />
        </mssql:SqlDatabase>
    </Component>

    <Component Id="SQLServerCreateUserWA" Guid="">
        <Condition>INSTALLDB AND DBCREATEUSER = 1</Condition>
        <mssql:SqlDatabase Id="dbWA" Server="localhost" Database="[DATABASENAME]">
            <mssql:SqlString Id="dbWACreateUser" ContinueOnError="no" ExecuteOnInstall="yes" ExecuteOnReinstall="no" ExecuteOnUninstall="no" Sequence="1" SQL="" />
         </mssql:SqlDatabase>
    </Component>
</ComponentGroup>

I want to ensure that the SQLServerInstallScriptWA component is executed before SQLServerCreateUserWA component.

+1  A: 

Components are not ordered. However, SqlScript and SqlString have Sequence attributes that can be used to impose order. The SqlScript and SqlString Sequence attributes happen to be ordered together to handle just this scenario.

Rob Mensching
Sequence is carried from component to component then?
Jeff
I think it is safer to say that @Sequence has nothing to do with Component.
Rob Mensching
I believe that the order of the ComponentRefs in the Feautre dictate the order of execution. Generally.
Will