【发布时间】:2010-10-23 17:34:16
【问题描述】:
是否可以像使用 connectionStrings 或 appSettings 一样将 applicationSettings 移动到另一个配置文件?
当我使用设计器为我的 Web 应用程序创建设置时,我会在 web.config 中获得 applicationSettings 部分,例如:
<applicationSettings>
<TestWebApplication.Properties.Settings>
<setting name="AnotherSetting" serializeAs="String">
<value>Another setting value</value>
</setting>
</TestWebApplication.Properties.Settings>
</applicationSettings>
我希望能够将它们移动到另一个文件,例如 appSettings:
<appSettings configSource="config\appsettings.config"/>
我正在处理一个项目,该项目具有通过设计器生成的类访问的大量设置,而 web.config 很难在多个环境之间维护。如果我可以强制 Settings 类使用 appSettings 而不是 applicationSettings,那就更好了。
有可能吗?
提前感谢您的帮助。
【问题讨论】:
标签: asp.net configuration web-config settings