私はDLLを持っています.Dllは、主にWCFのためにいくつかの設定が必要です。共有ライブラリApp.Config
私はこのDLLをいくつかのアプリケーションで使用していますが、どうすればそのDLLのapp.configをアプリケーションapp.configに組み込むことができますか?
ありがとうございます。
私はDLLを持っています.Dllは、主にWCFのためにいくつかの設定が必要です。共有ライブラリApp.Config
私はこのDLLをいくつかのアプリケーションで使用していますが、どうすればそのDLLのapp.configをアプリケーションapp.configに組み込むことができますか?
ありがとうございます。
dllのアプリ設定では、2つの部分をコピーする必要があります。これらをアプリケーションのapp.configファイルに貼り付けます。
まず、上部付近に宣言が必要です。アプリケーションの既存の構成セクションにこれらをマージする必要があります。
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="MyApplication.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
その後、あなたはconfigSections
<applicationSettings>
<MyApplication.Settings>
<setting name="Setting1" serializeAs="String">
<value>hello world</value>
</setting>
<setting name="Setting2" serializeAs="String">
<value>This is my value!</value>
</setting>
</MyApplication.Settings>
</applicationSettings>
自動的にあなたのdllのapp.configをに取って代わるだろう実行するアプリのためのアプリケーションの構成と同じレベルであなたの実際の構成セクションを持っています。
このトピックを扱っCodeProjectの上で良い記事があります: http://www.codeproject.com/KB/dotnet/dllappconfig.aspx