Hi guys,

I'm having an issue with components with feature conditions not being actioned.

My feature tree is:

    <Feature Id="ProductFeature"
             Title="My Service"
             Level="1"
             AllowAdvertise="no"
             InstallDefault="local"
             Absent="disallow"
             ConfigurableDirectory="INSTALLLOCATION">

      <!-- Note: The following ComponentGroupRef is required to pull in 
generated authoring from project references. -->
      <!--<ComponentGroupRef Id="Product.Generated" />-->

      <ComponentRef Id="ServiceWebsite" />
      <ComponentRef Id="ServiceComponentContent" />
      <ComponentRef Id="ServiceComponentBinaries" />
      <ComponentRef Id="SqlServerProviderConfiguration" />

      <Feature Id="Postgres"
               Title="Postgres Support"
               Level="1"
               AllowAdvertise="no"
               InstallDefault="local"
               Absent="allow">
        <ComponentRef Id="PostgresComponent" />
        <ComponentRef Id="PostgresProviderConfiguration" />
      </Feature>

    </Feature>

The installer is intended to configure a web.config connection string for the 
first installation to assign a provider value depending on whether Sql Server 
or Postgres is used. My components for updating the web.config are:

    <Component Id="PostgresProviderConfiguration"
               Guid="{77187558-B8F1-45A7-A6E2-CA9430D349A1}"
               Directory="INSTALLLOCATION">

      <CreateFolder />

      <Condition><![CDATA[&Postgres = 3 AND NOT INSTALLED]]></Condition>

      <!-- Set  Connection provider -->
      <util:XmlFile Id="SetConnectionProviderToPostgres"
                    Action="setValue"
                    File="[INSTALLLOCATION]\web.config"
                    ElementPath="configuration/connectionStrings/add[...@name = 
'MyService'[\]]/@providerName"
                    Value="Npgsql" />

    </Component>

    <Component Id="SqlServerProviderConfiguration"
               Guid="{C4E8F847-56F9-475F-A944-04BE2D928D46}"
               Directory="INSTALLLOCATION">

      <CreateFolder />

      <Condition><![CDATA[&Postgres = 2 AND NOT INSTALLED]]></Condition>

      <!-- Set  Connection provider -->
      <util:XmlFile Id="SetConnectionProviderToSqlServer"
                    Action="setValue"
                    File="[INSTALLLOCATION]\web.config"
                    ElementPath="configuration/connectionStrings/add[...@name = 
'MyService'[\]]/@providerName"
                    Value="System.Data.SqlClient" />

    </Component>

Neither of these components are run no matter which features are selected. I 
have removed the condition and also tested the condition with just NOT 
INSTALLED and both these scenarios cause the appropriate component to be 
actioned. I have also incorrectly spelled the feature name and compiled with an 
error to ensure that the correct feature name is being used.

It seems like the &Postgres = 2/3 is not being evaluated correctly.

Where am I going wrong?

Cheers,

Rory

------------------------------------------------------------------------------

_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to