【发布时间】:2012-07-25 23:06:42
【问题描述】:
是否可以在我的 app.config 中有一个 <appSettings /> 部分,其中包含许多设置,但它还引用了不同文件中的 <appSettings /> 部分?
这将允许我保留只有开发人员应该感兴趣的配置选项,例如在主窗口上显示调试输出的选项(非常混乱但对我很有用)或将某些文件保存到特定位置。
具体来说,这是我想要实现的目标:
<!-- this is the appSettings section of the normal app.config file,
which also contains everything else that app.config would -->
<appSettings configSource="AppSettings.config"> <!-- references another file -->
<add key="deployment_config_option1" value="1"/>
<add key="deployment_config_option2" value="2"/>
</appSettings>
<!-- this a new appSettings section of another file called DevSettings.Config
which only contains settings us developers are interested in
by keeping these settings in a different file,
I can ensure it's never deployed -->
<appSettings> <!-- references another file -->
<add key="show_debug_on_screen" value="true"/>
<add key="save_copy_to_desktop" value="false"/>
</appSettings>
【问题讨论】:
-
不是重复的。这个问题比我的更笼统。
-
基本上是一样的。您希望您的 app.config 包含其他配置。如果您不想部署第二个配置,您只需确保删除已部署的 app.config 中包含的应用配置。
标签: .net visual-studio-2010 app-config