【问题标题】:How to save to external config file如何保存到外部配置文件
【发布时间】:2012-09-15 13:50:00
【问题描述】:

在 ABC.exe.config (app.config) 中

<configuration>
    <appSettings file="MySettings.config">
        <add key="setting1" value="1" />
    </appSettings>
<configuration>

这里我使用“file”属性,而不是“configSource”,因为我想定义默认值。 如何保存到外部配置文件“MySettings.config”? 我必须保持“ABC.exe.config”不变,因为它会在程序升级时被覆盖,恕不另行通知。所有全局设置都必须保存在“MySettings.config”中

【问题讨论】:

标签: c# .net app-config


【解决方案1】:

在 MSDN documentation 中有一个例子,方法是自己处理对文件的写入,例如将其视为“常规”XML 文件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-14
    • 1970-01-01
    • 2011-09-20
    • 2018-01-30
    相关资源
    最近更新 更多