私はこのコードを継承しましたフォームConfigurationManagerを使用してカスタム構成セクションを変更できますか?
<?xml version="1.0" encoding="utf-8"?>
<Custom.Config>
<add key="foo" value="bar" />
</Custom.Config>
のカスタム設定ファイルCustom.config
でフォームのApp.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="Custom.Config" type="System.Configuration.DictionarySectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<kCura.Config configSource="Custom.config" />
</configuration>
を持っており、これに関連する既存のConfigurationSection
またはConfigurationSectionHandler
ありませんCustom.Config
セクション。
私は
DirectCast(System.Configuration.ConfigurationManager.GetSection("Custom.Config"), System.Collections.IDictionary)
でうまくfoo
の値にアクセスすることができます。しかし、今、私はプログラム的に(テスト目的のために)、更新にするために、この値をしたいと思います。 これは可能ですか?
私は以下を読みましたが、私はまだ困惑しています。あなたはその後、
- How to: Create Custom Configuration Sections Using ConfigurationSection
- How to: Create Custom Configuration Sections Using IConfigurationSectionHandler
ソースの値を更新して保存する方法はありません。デプロイメントの設定方法によっては、その段階でこれらの値を上書きすることができます。 Octopusのようなツールは、変換を使用してこれを行います。 – nurdyguy