Introduction
Part of setting up an application is making sure that it's configured correctly for the environment where it will run. For example, if we're installing to a development machine, we'd set up our database connection strings differently than if we're installing to production. With WiX, we can install an XML configuration file and then transform it on the fly.
In this chapter, we'll see several transformations that you can perform on XML, including adding and removing elements, adding attributes and inner text, and creating an element only if it doesn't already exist. All of these functionalities come from a versatile element called XmlConfig
that can be found in the WiX UtilExtension
namespace.
You might be wondering how using WiX to transform an XML file at installation time stacks up against the alternatives. One is to keep separate configuration files for each environment. The benefit of this approach is that it's easy to start off with. It doesn't take much to copy one file into...