.net 4.0プロジェクト用にconfigSectionを設定しようとしています。しかし.net 4.0でconfigSectionを設定する方法
<configuration>
<configSections>
<section name="MonitorFldrSection"
type="System.Configuration.NameValueFileSectionHandler, System, Version=4.0.0.0"
allowLocation="true"
allowDefinition="Everywhere"/>
</configSections>
<MonitorFldrSection>
<add name="fldr1" value="C:\Temp" />
<add name="fldr2" value="C:\Projects" />
</MonitorFldrSection>
<connectionStrings>
</connectionStrings>
<appSettings>
</appSettings>
</configuration>
、私はキーを追加しようとしたとき、私はプロンプトのために取得するすべての コメントしているか、私は
object obj = ConfigurationManager.GetSection("MonitorFldrSection");
は、私はこのエラーを取得するコードにアクセスしようとすると、CDATAが
を促し:{"MonitorFldrSectionの構成セクションハンドラを作成する際にエラーが発生しました:ファイルまたはアセンブリ 'System、Version = 4.0.0.0'またはその依存関係の1つを読み込めませんでした。システムが指定されたファイルを見つけることができません(C:\ Projects_4.0 \ NasImageIndexer \ TestForm \ bin \ Debug \ TestFor m.exe.Config line 5) "}
NameValueFileSectionHandlerと一緒にAppSettingsSectionとDictionarySectionHandlerも試しました。
私は間違っていますか?
はい、私はTestForm.exe.Configを見つけることができますが、getti同じエラー – edepperson
愚かですが、リリースモードで実行している場合は、このエラーを何度か繰り返していましたが、デバッグモードでbin \ releaseを確認してください。bin \ debugを確認してください。 – Kiru
何が、 Version = 4.0.0.0ですが、そのファイルはC:¥Program Files¥Reference Assemblies¥Microsoft¥Framework¥.NETFramework¥v4.0にあります。しかし、そのバージョンは4.0.30319.1です。 – edepperson