One of the common things that you might want to do in a setup package is to perform different actions based on either a parameter passed into the setup program, or from user response during the installation.    I normally use this strategy to choose between creating an integrated connection string and a connection string that uses sql security.  In Wix there is a <Condition> element.  When used in conjuction with a property you can use to control what component is installed.   For example below is a snippet of wix code that if the property USEINTEGRATEDSECURITY equals 1 then it will run the ConnectionStringIntegatedComponent and if it is not equal to 1 that it will run the ConnectinStringNonIntegratedComponent.

<Component Id="ConnectionStringIntegratedComponent" 
Guid="INSERT-YOUR-GUID-HERE" > <Condition> USEINTEGRATEDSECURITY = 1</Condition> <CreateFolder/> <util:XmlFile Id="XmlSettings1"
File="[INSTALLDIR]web.config"
Action="setValue"
ElementPath="/configuration/connectionStrings/add[\[]@name='ConnectionString'[\]]/@connectionString"
Value="Data Source=[SERVERNAMEEDITBOXVALUE]; database=[DATABASEEDITBOXVALUE];Integrated Security=True" /> </Component>

<Component Id="ConnectionStringNonIntegratedComponent" Guid="INSERT-YOUR-GUID-HERE" >
            <Condition><![CDATA[USEINTEGRATEDSECURITY <>1]]> </Condition>
            <CreateFolder/>
            <util:XmlFile Id="XmlSettings2" 
File="[INSTALLDIR]web.config" Action="setValue"
ElementPath="/configuration/connectionStrings/add[\[]@name='ConnectionString'[\]]/@connectionString"
Value="Data Source=[SERVERNAMEEDITBOXVALUE]; User ID=[PASSWORDUSEREDITBOXVALUE];Password=[PASSWORDEDITBOXVALUE]; database=[DATABASEEDITBOXVALUE];" /> </Component>
Advertisements