Greetings,

Long story short: XmlFile is being executed during upgrades when I
only want it executed on new installations.

2 features are used to determine whether database install or upgrade
(both executed by DTF external tool) takes place:

    <Feature Id="DatabaseCreateFeature" Title="Create Database" Level="1"
             ConfigurableDirectory="INSTALLLOCATION"
Description="Create database"
             Absent="allow" AllowAdvertise="no">
      <Condition Level="0">UPGRADEFOUND</Condition>
      <ComponentGroupRef Id="WebConfigSetupComponents" />
    </Feature>

    <Feature Id="DatabaseUpgradeFeature" Title="Upgrade Database" Level="1"
             ConfigurableDirectory="INSTALLLOCATION"
Description="Upgrade database"
             Absent="allow" AllowAdvertise="no">
      <Condition Level="0">NOT UPGRADEFOUND</Condition>
    </Feature>

WebConfigSetupComponents is used to update a web.config file after a
custom dialog gets db connection string details for new installations,
and because of the different authentication methods (SQL
Authentication or Windows Integrated Security), there are 2 components
which are conditioned based on user selected property
USEINTEGRATEDSECURITY:

    <ComponentGroup Id="WebConfigSetupComponents">
      <ComponentRef Id="WebConfigSqlDbWinAuthComponent" />
      <ComponentRef Id="WebConfigSqlDbSqlAuthComponent" />
    </ComponentGroup>

    <Component Id="WebConfigSqlDbWinAuthComponent" KeyPath="yes"
Guid="0000B957-2280-44CA-912E-0E53F182B947">
      <Condition>USEINTEGRATEDSECURITY = 1</Condition>
      <util:XmlFile Id="UpdateWebConfigSqlDbWinAuth"
File="[INSTALLLOCATION]\Web.config"

ElementPath="/configuration/connectionStrings/add[...@name='Database'[\]]/@connectionString"

Value="Database=[TARGETDBNAME];Server=[TARGETDBSERVER];Integrated
Security=SSPI;"
                    Action="setValue" />
    </Component>

    <Component Id="WebConfigSqlDbSqlAuthComponent" KeyPath="yes"
Guid="0000D17C-D59E-4978-AF4D-239EC848F9C2">
      <Condition><![CDATA[USEINTEGRATEDSECURITY <> 1]]></Condition>
      <util:XmlFile Id="UpdateWebConfigSqlDbSqlAuth"
File="[INSTALLLOCATION]\Web.config"

ElementPath="/configuration/connectionStrings/add[...@name='Database'[\]]/@connectionString"

Value="Database=[TARGETDBNAME];Server=[TARGETDBSERVER];uid=[TARGETDBUSERNAME];pwd=[TARGETDBUSERPASSWORD];"
                    Action="setValue" />
    </Component>

Everything is working *except* during upgrades, where XmlFile still
gets called, and it empties out the connectionString attribute in
web.config.

Any help appreciated, thanks.

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to