Book Image

WiX Cookbook

By : Nicholas Matthew Ramirez
1 (1)
Book Image

WiX Cookbook

1 (1)
By: Nicholas Matthew Ramirez

Overview of this book

Table of Contents (20 chapters)
WiX Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Setting the value of an attribute on an XML element


Although settings can often be configured by adding entire elements, others can be configured by setting an attribute on an already existing element. For example, we can replace a default database connection string by setting the connectionString attribute on an add element. By doing it at installation time, we're given the flexibility to collect the connection details from the user or base them on the environment in which the installer is running. In this recipe, we'll see how to use the XmlConfig element to change a default connection string to something else.

Getting ready

To prepare for this recipe, perform the following steps:

  1. Create a new setup project and name it XmlAttributeInstaller.

  2. Add an XML file to the project and call it Web.config. Add the following markup to it:

    <?xml version="1.0"?>
    <configuration>
      <appSettings />
      <connectionStrings>
        <add name="mydb" providerName="System.Data.SqlClient" connectionString...