XmlPreprocess can be invoked as a custom action by an MSI to merge environment settings into your configuration files at deployment time.
Integration with Visual Studio Setup Projects
Add a custom page with two text boxes to the installer's UI to collect the settings file name into a property named SETTINGSFILE, and optionally additional custom properties into a property named CUSTOMSETTINGS
Add the XmlPreprocess.exe file to the installer
Add a custom action that invokes XmlPreprocess.exe with the appropriate command line parameters, for example:
/s "[SETTINGSFILE]" /i "[TARGETDIR]web.config" [CUSTOMSETTINGS]
Integration with WiX
See the WiXSetup sample for the WiX script necessary to integrate with WiX 3.*
XmlPreprocess.exe can also be invoked by InstallUtil.exe with the same basic command line syntax
Note: The InstallUtil interface is deprecated, and is not in sync with the command line.
InstallUtil.exe /i=web.config /s=dt_settings.xml /d:installer /d:debug /d:trace=4 XmlPreprocess.exe
This will perform exactly the same deployment as the first
Command Line example.