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 ...

Get WiX Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.