Intellisense for custom configuration problem with namespaces

I just expanded a custom configuration section, created a schema accompanying document for Intellisense, and added it to the Web.config Schemas property in accordance with Michael Stum's answer to another similar question.

Unfortunately, perhaps because I create XSD manually with limited knowledge, Intellisense relies on the xmlns attribute to indicate that the XSD file namespace is present in the custom configuration item. However, when I start the project, I get the Unrecognized 'xmlns' attribute . Note that attribute names are case-sensitive .

Perhaps I could just modify my XSD file to define the xmlns attribute for this element, however I am wondering if this fix is ​​just for a more complex task. I have to admit that I'm not very good at XML namespaces, so this may be an opportunity to ask me a few things.

Here are the attributes for my root XSD xs:schema file:

 <xs:schema id="awesomeConfig" targetNamespace="http://awesome.com/schemas" xmlns="http://awesome.com/schemas" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> ... </xs:schema> 

And when creating an element in the Web.config file, Visual Studio 2008 automatically adds:

 <awesomeConfig xmlns="http://awesome.com/schemas"></awesomeConfig> 

So, I did not understand the meaning of the xs:schema attributes at all, or is this the right solution as simple as it seems?

+4
intellisense configurationsection
source share
1 answer

Your schema will have to omit the targetNamespace attribute. Essentially, this will put the contents of the schema in the default namespace.

This is necessary because the .NET configuration system never allowed elements to be in the namespace.

+4
source share

All Articles