views:

375

answers:

2

I have this .NET application which use Settings.settings and app.conf as configuration repositories instead of the Windows Registry. It seems pretty easy to ask questions to the user during the installation and write the responses to the Windows Registry, but I have not found yet a way to write the responses to the app.config file. Does anyone knows how?

A: 

I have done project like that that requried users to supply all the parameters during the installation. You can create custom form containing all your Labels and TextBoxes and Button. And in your installer class use that form as property of your Installer class.

Here is an example

[RunInstaller(true)]
public partial class MyCustomInstaller : Installer
{
      private MyCustomForm = new MyCustomForm();
      // this is your custom form that allows users to modify the configuration parameters.
}

and then you can caputure event like this :

  private void InitializeComponent()
  {
      this.AfterInstall += new System.Configuration.Install.InstallEventHandler(DoConfigurationManagement_AfterInstall);
  }
Shiva
+1  A: 

You can have a look at this that explains how to use CustomActions to change app.config file from the msi installer.

davsan