web.config, configSource, and "The 'xxx' element is not declared" warning.

Posted by UpTheCreek on Stack Overflow See other posts from Stack Overflow or by UpTheCreek
Published on 2010-05-14T09:58:41Z Indexed on 2010/05/14 10:04 UTC
Read the original article Hit count: 542

Filed under:
|
|
|

I have broken down the horribly unwieldy web.config file into individual files for some of the sections (e.g. connectionStrings, authentication, pages etc.) using the configSource attribute.

This is working file, but the individual xml files that hold the section 'snippets' cause warnings in VS.

For example, a file named roleManager.config is used for the role manager section, and looks like this:

<roleManager enabled="false">
</rolemanager>

However I get a blue squiggle under the roleManager element in VS, and the following warning: The 'roleManager' element is not declared

I guess this is something to do with valid xml and schemas etc. Is there an easy way to fix this? Something I can add to the individual files?

Thanks

P.S. I have heard that it is bad practice to break the web.config file out like this. But don't really understand why - can anyone illuminate me?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about web.config