[wix-users] Problem with generation of GUID while iteratively executing a Sql script

Venkatesan, Ravikumar Ravikumar.Venkatesan at scientificgames.com
Mon Mar 14 04:46:18 PDT 2016


Hello All,

                I am trying to create an installer for my Application which would have a varied number of DBs depending on the Client’s choice of installation. I have a SQL script file that should be executed from the WiX installer on all the available DBs (the number of DBs shall only be determined at the runtime). I am not clear on how to execute the Sql script file on a dynamic list of DBs. Could someone please assist?!

I’ve the below sample code that works well if I’ve only one DB to execute the script. If the number of the DBs to execute the script is more than 1 then it throws the below mentioned error.

                Sample Code:

  <?define DynamicDBList="FinalStaging;FinalStaging2;FinalStaging3"?>

                                  <?foreach DynamicDB in $(var.DynamicDBList)?>
    <Fragment Id='Fragment.$(var.DynamicDB)'>
      <sql:SqlDatabase Id='Dynamic_SQLDB.$(var.DynamicDB)' Database='$(var.DynamicDB)' User='SQLUser_local_ETL' Server='[DATABASE_SERVER]'/>

      <ComponentGroup Id='cmpg.$(var.DynamicDB)' Directory='$(var.DynamicDB)'>
        <Component Id='cmp.$(var.DynamicDB)' Guid='*' >
          <sql:SqlScript Id='ss_TestScript' BinaryKey='bi_TestScript' ExecuteOnInstall='yes' SqlDb='Dynamic_SQLDB.$(var.DynamicDB)' Sequence='1'  />
        </Component>
      </ComponentGroup>
    </Fragment>
  <?endforeach?>


                Compilation Error: [Same error comes 3 times since there’s an iteration of 3]
                                The Component/@Guid attribute's value '*' is not valid for this component because it does not meet the criteria for having an automatically generated guid. Components using a Directory as a KeyPath or containing ODBCDataSource child elements cannot use an automatically generated guid. Make sure your component doesn't have a Directory as the KeyPath and move any ODBCDataSource child elements to components with explicit component guids.

                Any help or insight on how to solve this problem would be much appreciated.

Regards,
Ravy


Ravikumar Venkatesan | Lead Analyst | Bally Technologies India Private Limited<http://www.ballytech.com>   | (M) +91 98 8436 0607

May be privileged. May be confidential. Please delete if not the addressee.
Venkatesan Venkatesan



More information about the wix-users mailing list