title: WIX Order of execution with Custom Action
body: <p>I have a wix project that installs a web site, a couple of SQL Server databases and configures users etc.</p>
  
  <p>Part of the install creates a database for the ASP.NET membership system using a Custom Action to execute aspnet_regsql.exe.</p>
  
  <p>Another part of the installation then needs to execute a SQL script to create an initial user. The problem is that the script component is getting executed before the Custom Action has happened, so the references to membership tables and stored procedures in the script are invalid and the install fails.</p>
  
  <p>This is part of my install file:</p>
  
  <pre><code>&lt;Feature Id="Complete" Title="Darzi Web" Level="1" Display="expand" ConfigurableDirectory="INSTALLDIR"&gt;
    &lt;ComponentGroupRef Id="SiteIISConfig"/&gt;
    &lt;ComponentGroupRef Id="SQLConfig" /&gt;
    &lt;ComponentGroupRef Id="InstallFiles" /&gt;
    &lt;ComponentRef Id="WebConfigChanges" /&gt;
    &lt;ComponentGroupRef Id="SQLBootstrap" /&gt;
  &lt;/Feature&gt;
  
  &lt;InstallExecuteSequence&gt;
    &lt;Custom Action='RegSql'  After='InstallFiles'/&gt;
  &lt;/InstallExecuteSequence&gt;
  </code></pre>
  
  <p>I need a way to tell the installer to make sure that "SQLBootstrap" happens after "RegSql".</p>
  
  <p>Any help would be gratefully received.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This is the section that runs the Bootstrap SQL:</p>
  
  <pre><code>&lt;Fragment&gt;
  &lt;DirectoryRef Id="INSTALLDIR"&gt;
    &lt;Component Id="SqlBoostrapComponent" Guid="CAAA1447-446F-4C1B-9239-812ABA5AF0FF" KeyPath="yes"&gt;
  
        &lt;sql:SqlScript SqlDb='DarziAspNetDbDatabase' Id='Bootstrap' BinaryKey='Bootstrap' ExecuteOnInstall='yes' Sequence='1' /&gt;
  
    &lt;/Component&gt;
  &lt;/DirectoryRef&gt;
  
  
  &lt;Binary Id='Bootstrap' SourceFile='Bootstrap.sql' /&gt;
  
  &lt;ComponentGroup Id="SQLBootstrap"&gt;
    &lt;ComponentRef Id="SqlBoostrapComponent" /&gt;
  &lt;/ComponentGroup&gt;
  
  &lt;/Fragment&gt;
  </code></pre>