I'm completely new to WiX (and to MSI in general), and I'm probably barking up the wrong tree, but I was hoping to find a way to conditionally run a SQL script, for upgrading a database schema. I'd like a way to run a SQL command and store the scalar return value in a property. Something like this:
<Property Id="CONNECTION_STRING"> <RegistrySearch Id="CONNECTION_STRING_SEARCH" Root="HKLM" Key="SOFTWARE\My\Application" Name="ConnectionString" Type="raw" /> </Property> <Property Id="DATABASE_VERSION"> <my:SqlSearch ConnectionString="[CONNECTION_STRING]" ScalarQuery="SELECT COALESCE(MAX(Revision), 0) FROM Releases" /> </Property> Are <Property> searches sequenced to make even this possible? I was planning to then use this property to conditionally enable/disable a set of <Component>s, something like this: <Component Id="Not_Installed"> <Condition>DATABASE_VERSION = 0</Condition> <sql:SqlScript BinaryKey="Not_Installed_SQL" /> </Component> <Component Id="v1_Installed"> <Condition>DATABASE_VERSION = 1</Condition> <sql:SqlScript BinaryKey="Upgrade_v1_to_v2_SQL" /> <sql:SqlScript BinaryKey="Upgrade_v2_to_v3_SQL" /> </Component> <Component Id="v2_Installed"> <Condition>DATABASE_VERSION = 2</Condition> <sql:SqlScript BinaryKey="Upgrade_v2_to_v3_SQL" /> </Component> (obviously I've elided a bunch of stuff) WiX doesn't (as of v3.0.2420.0) support extensions under <Property>, which means that I can't invent a SqlSearch extension. So: even if WiX _did_ support <Property> extensions, would this have worked? If it would, are we likely to see <Property> extensions. Is this a limitation of Windows Installer? Should I invent a custom action like the following instead? <sqlex:SqlScriptIf ConnectionString="[CONNECTION_STRING]" ScalarQuery="SELECT COALESCE(MAX(Revision), 0) FROM Releases" IfMatch="2" BinaryKey="Upgrade_v2_to_v3_SQL" /> I figure that's going to be horrendously complicated, though. Otherwise, what's the recommended way to do something like this? Regards, Roger. ----------------------------------------- DISCLAIMER: This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind 1E Ltd to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. THINK GREEN: Help save the environment - do you really need to print this email? ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users