Initializing user.config or app.exe.config during install

前端 未结 3 1876
醉酒成梦
醉酒成梦 2021-02-20 07:25

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

相关标签:
3条回答
  • 2021-02-20 08:02

    If you create this application for larger companies, then you should have a look at Group Policy. Unfortunately, it'll bring your application back to the golden age of registry. I understand, that this would be a huge change in your program, but this is the way to this.

    However, if the web service's URL is the only thing, you have to setup this way, then GPO might be an overkill. In that case I would hardcode the executable's name.

    0 讨论(0)
  • 2021-02-20 08:07

    I know that's not exactly the answer you're looking for, but you should opt for a more "serious" installer. We're using Advanced Installer and it's a blast, does anything and everything you can think of.

    0 讨论(0)
  • 2021-02-20 08:11

    If it is acceptable for you to hardcode at least one setting in the config file, you can use this to point to a database or web service or network file path where all the custom config settings can be stored. Using System.Configuration.ConfigurationManager.OpenExeConfiguration() you can then update the config file from this location either on the first run or every time that the application starts up.

    0 讨论(0)
提交回复
热议问题