を他の回答が言うように、あなたのカスタム構成セクションのためのXMLスキーマ文書を提供する必要があります。一部のグローバルディレクトリに.xsd
スキーマファイルを追加する必要はありません。あなたはApp.config
ファイルにカスタムセクションから直接それを参照することができます
<configuration>
<!-- make the custom section known to .NET's configuration manager -->
<configSections>
<section name="customSection" type="..." />
</configSections>
<!-- your custom section -->
<customSection xmlns="http://tempuri.org/customSection.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="customSection.xsd">
...
</customSection>
<configuration>
xmlns
属性は、デフォルトの名前空間を設定するだけであり、あなたがあなたのcustomSection
要素とのすべてにそれを設定する必要はありませんようにその子要素。 (ただし、<configuration>
要素にxmlns
属性を置かないでください!)customSection.xsd
は、例えば、インテリセンスで使用されるスキーマが含まれ
:
<xs:schema id="customSectionSchema"
targetNamespace="http://tempuri.org/customSection.xsd"
elementFormDefault="qualified"
xmlns="http://tempuri.org/customSection.xsd"
xmlns:mstns="http://tempuri.org/customSection.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="customSection">
...
</xs:element>
</xs:schema>
+1受け入れられたソリューションは広く実践されているようですが、スキーマの変更が標準であり、コンピュータ上に作成される可能性のあるすべてのVisual Studioプロジェクトにとって有用でない限り、これを行うべきではありません(http://msdn.microsoft.com/ ja-jp/library/ms255821.aspx) – Paul