Search code examples
visual-studioinstallationsetup-projectcustom-action

Renaming config files with Visual Studio setup project


My applications have a handful of config files, each one particular to the machine it's being deployed to (dev, production, etc.) I'm wanting to add them to the setup project, use radio buttons to select one and then have a script (or maybe custom action?) rename the selected files to connectionStrings.config, settings.config, etc.

Is this feasible/possible with a setup project?

To give you an idea, my configs might look like this:

DEV connectionStrings.config
PROD connectionStrings.config

After the user chooses DEV or PROD in the installer radiobutton UI, I would like the chosen config to be renamed to

connectionStrings.config

Considering it's a VS setup project, I have a feeling I'm asking for way too much and that I will get an interesting response as most setup project questions do :)


Solution

  • I've come to the conclusion that this is impossible due to VS severely lacking on setup project configuration options. Instead I added a radio button control during the setup process and assigned the choices a variable name. In the file system I added all of my config files and then set conditions to each one. They referenced values to my radio button choices in order to copy during deployment.