अन्य उत्तर के रूप में आप अपने कस्टम विन्यास खंड के लिए एक 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
स्कीमा कि उदाहरण के लिए IntelliSense द्वारा उपयोग किया जाएगा, शामिल हैं:
<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 स्वीकार्य समाधान व्यापक रूप से अभ्यास किया जाता है, लेकिन आपको यह तब तक नहीं करना चाहिए जब तक स्कीमा परिवर्तन मानक और उपयोगी नहीं है, जो आपके कंप्यूटर पर बनाई जा सकने वाली सभी विजुअल स्टूडियो परियोजनाओं के लिए उपयोगी हो। (Http://msdn.microsoft.com/ en-us/library/ms255821.aspx) – Paul