<appSettings> の <add> 要素

カスタム アプリケーション設定を追加します。

configuration
  <appSettings>
    <add>

構文

<appSettings>
  <add key="Key of custom setting" value="Value of custom setting" />
</appSettings>

属性

説明
key 必須の属性です。

追加するキーの名前を指定します。
value 必須の属性です。

追加するキーの値を指定します。

親要素

説明
<appSettings> ファイル パス、XML Web サービス URL、またはアプリケーションのその他のカスタム構成情報など、カスタム アプリケーションの設定が含まれています。

子要素

なし

次の例は、アプリケーション名のカスタム構成設定を追加する方法を示しています。

<appSettings>
  <add key="ApplicationName" value="MyApplication" />
</appSettings>

次の例では、<add> 要素を使用して、ASP.NET アプリケーションで 2 つの互換性設定を定義します。

<appSettings>
  <add key="AppContext.SetSwitch:Switch.System.Globalization.NoAsyncCurrentCulture" value="true" />
  <add key="AppContext.SetSwitch:Switch.System.Uri.DontEnableStrictRFC3986ReservedCharacterSets" value="true" />
</appSettings>

関連項目