在运行时可能交换的app.config? [英] Is switching app.config at runtime possible?

查看:101
本文介绍了在运行时可能交换的app.config?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有在运行时的方式转出的应用程序的app.config(current.config到new.config,文件文件)。我有一个备份/恢复的过程,需要更换自己的application.exe.config文件。我已经看到了这发布,但它并没有回答如何在运行时做到这一点。

Is there a way at runtime to switch out an applications app.config (current.config to new.config, file for file). I have a backup/restore process which needs to replace its own application.exe.config file. I have seen this post but it does not answer how to do this at runtime.

推荐答案

原来我可以交换config文件的新一,做好每个部分一ConfigurationManager.RefreshSection(...)。它会更新从新的config文件。

Turns out I can swap the .config file for the new one and do a ConfigurationManager.RefreshSection(...) for each section. It will update from the new .config file.

这篇关于在运行时可能交换的app.config?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆