I am developing a .NET WinForms application which relies on user.config to store various useful settings such as intranet web service URLs. We would like to make it possible to import custom initial settings as part of the installation. The use case for this is if a company has 100 machines they want to install the software on, and they should all have a reference to the intranet web service in question, this should not need to be set up manually on all the machines.
We are currently using a VS2008 setup project to generate the install package.
Our idea so far has been to enable the installer to make a custom initial .config file with the information (from a template), and then put that in place instead of the default one that the setup project installs.
However, I can't see a way to do this other than these few:
- Hardcode the executable name into a custom installer action (deriving from System.Configuration.Install.Installer), in order to use the ConfigurationManager class to determine the .config file path. This would require manual changes to the installer if the executable name changes.
- Roll our own configuration classes or file/folder hierarchy to store the settings. This would basically bar us from the advantages of the isolation mechanism (which is also the obstacle here) that .NET provides, if I understand correctly.
Does anyone know of any alternatives, or of ways to make the above two palatable?
I fear the answer may be "don't do this, it defeats the spirit of the mechanism, roll your own settings import mechanism".