app.config を作成したばかりのときは、ConfigurationManager.AppSettings[0] または ConfigurationManager.AppSettings["keyName"] を試すたびに null が返されました。だから私はこのような app.config を作成した *.settings ファイルを使用しようとしました
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="IndexLoader.IndexLoader" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<IndexLoader.IndexLoader>
<setting name="ConnectionString" serializeAs="String">
<value>INITIAL CATALOG=xxx;DATA SOURCE=xxx;User ID=xxx;Password=xxx;Application Name=xxx;</value>
</setting>
</IndexLoader.IndexLoader>
</applicationSettings>
</configuration>
C# を使用してこの接続文字列を読み取るにはどうすればよいでしょうか。
ソリューションには複数のプロジェクトがあり、それらの多くには構成ファイルがあります。コードのプロジェクトの構成ファイルを使用するように指定する方法はありますか?