With the built-in Visual Studio Setup projects, there are some UI elements that can be configured and outputs captured, but in general my opinion is that they are rather clumsy to use. You can certainly spend some money for a third party installation framework and get a lot more horsepower to do what you need.
In some cases however, you may only need to allow the user who is installing your product to change some existing settings, during the installation, and if this is the case, then read on - I have an easy solution for you.
This all came about because this morning my erstwhile site partner and I were discussing this very subject. He needed to be able to update versioned SQL Server database schemas, and I needed to allow my users to modify connection strings and other items related to how their new XYZ thingy service operated on their ABC machine, or differently on their DEF machine, and so on.
The trick to all this is to use the Custom Actions facility of the installer project. You can have the MSI Installer run an executable of your own design at this stage, and when it is done, the installation will complete and your user will be happy because they've been able to modify their desired runtime settings. The only other trick you need to know is how to pass the path to your main installed executable so that your Custom Action exe can pick it up and be able to know where to load your configuration file so it can be modifed. This is done in the Properties sheet for the Custom Action Commit folder where you'll have an item pointing to your InstallHelper utility that I give you here.
In order to set this up, I rolled the "InstallHelper" Windows Forms app. What this does is load your ABC.exe.config file that the installer just dropped into the deployment folder, iterate over all the appSettings elements, and dynamically create a set of labels and TextBoxes holding the key and value attributes respectively, allowing your user to modify the values of any or all of your settings. Then, all they need to do is press the COMMIT button and it saves the modified config file, closes the InstallHelper app, and your installation completes perfectly - now with the user's custom settings as desired.
The "Install Helper" does not need to derive from Installer. All it needs to know is how read and manipulate the command line. Moreover, this technique can be used for a lot of other things besides just modifying the configuration file - you can prompt the user to load a specific SQL Script and enter a connection string and then perform a database version update, for example.
Rather than get into a lot of code with this, I think it is more productive just to put my prototype here for download, and you can experiment with it yourself. The downloadable Visual Studio 2005 solution includes my InstallHelper exe project, a "TestProject", and an installer project to install the TestProject.
The most important part is to get the path correct in the Properties of the Custom Actions Commit item properties. In this case, I use built-in installer variables which will expand at installation to the actual path to the installed exe:

You add the Installer variables as shown, and the full name of your Executable whose config file is to be modified. These entries go in both Arguments and CustomActionData fields. The example here looks like this: [ProgramFilesFolder][Manufacturer]\[ProductName]\TestProject.exe What this does is pass the expanded full path to the command line of InstallHelper.exe, so it knows where to find the config file to load.
Build your installer. At install time, Install helper will come up and automatically read all your appSettings elements, and dynamically create a label and textbox for each so user can edit. Press COMMIT button to save, and the install will complete. Here's a sample:
You can download the full solution here.
|