I'd like to know what's the best way to add keys in the machine.config file at t开发者_JAVA百科he application deployment ? We have a series of WinForm apps that will need to use some keys that we wnat to store in the machine.config.
Thanks for your advices !
You could add a custom action to your installer (if you use one) that loads the machine.config, parses the xml, then adds the keys to the appropriate place, then saves the machine.config again. Only thing to be careful about is to create a backup before loading, parsing and writing the new contents and have some kind of rollback mechanism if any of these steps fails.
精彩评论