Changing App.config at Runtime

后端 未结 4 2005
旧时难觅i
旧时难觅i 2020-12-01 13:29

I\'m writing a test WinForms / C# / .NET 3.5 application for the system we\'re developing and we fell in the need to switch between .config files at runtime, but this is tur

4条回答
  •  情话喂你
    2020-12-01 14:03

    Assuming that the file handle to the configuration file is closed after the configuration file has been read and processed, I would send a message to the application to tell it to re-read the configuration file after you have updated the file. If this approach is not working, then I suspect (as Hogan suggested) that the file handle is not closed. What error codes are you getting from the file opening, reading and closing system calls? (use perror to report the error message)

提交回复
热议问题