size özel yapılandırma bölümü için bir XML şema belgesi sağlamanız gerekir, derler. Bazı genel dizine .xsd
şema dosyasını eklemenize gerek yoktur; Eğer App.config
dosyaya özel bölümden doğrudan başvurabilirsiniz:
<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
özellik size customSection
elemanı ve tümünde ayarlayın gerekmez, böylece varsayılan bir ad alanı ayarlamak için sadece orada onun çocuk elemanları. (Bununla birlikte, <configuration>
elemana xmlns
niteliğini koymayın!) customSection.xsd
örneğin IntelliSense tarafından kullanılacak şema içeren
:
<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 Kabul edilen çözüm yaygın olarak uygulanıyor, ancak şema değişiklikleri bilgisayarınızda oluşturulabilecek tüm Visual Studio projelerinde standart ve kullanışlı olmadıkça bunu yapmamalısınız. (Http://msdn.microsoft.com/ tr-us/library/ms255821.aspx) – Paul