For our approach we want to create one of the *.config files from scratch and populate it with some default/custom values at runtime.
Is there possibility to do this programatically via ConfigurationManager or something like that?
For our approach we want to create one of the *.config files from scratch and populate it with some default/custom values at runtime.
Is there possibility to do this programatically via ConfigurationManager or something like that?
Since .config files are just XML, you should be able to just use an XmlTextWriter
to build your config file.
sure it is, it's a simple and plain xml file
now... what config
file are you writing about? app.config
? web.config
? custom.config
?
first two are configuration support for the windows app and web app, so you would need to generate from an "outside" app and then fire that app up (witch that already happens with the Setup project where it asks for the user things and you can edit/add to the configuration file, like Database connections, etc)
Yes. As you point out, the ConfigurationManager
class allows you to read and write config files.
Scroll down a bit.
Sure, you can read / write these files as XML files, but the above class exposes a much handier interface for manipulating config files.