Search code examples
vbscriptwixwix3

WiX Search and Replace on a configuration file


I'm trying to make an install using WiX and I need to modify a configuration file (not XML or INI) with entries that a customized WiX dialog.

Is there a good way to do this? Do I need to make a VB script custom action, perhaps?

Below is the relevant bits of the wxs file:

   <Directory Id="TARGETDIR" Name="SourceDir">
     <Directory Id="ProgramFilesFolder">
         <Directory Id="INSTALLLOCATION" Name="MyApp">
             <Component Id="ap_cfg" KeyPath="yes" Guid="...">
                 <File Id="CONFIGFILE" Source="myConfig.cfg" />
              </Component>
         </Directory>
      </Directory>
   </Directory>

Solution

  • There is no build in Search & Replace construct in Wix, you will need to write a custom action.
    I suggest that instead of using VBScript you will use DTF which will enable you to write the custom action in .net and debug it under Visual Studio.