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

后端 未结 2 931
渐次进展
渐次进展 2021-02-05 04:23

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 configSour

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-05 04:50

    Searching a workaround to this matter using Custom Config Files, I found this solution. Dont know if is the correct one.

    The problem is that VS cant find a schema to validate your .config (xml). If you are using "native" configuration elements or when you create your custom .config files you must set to every xml document a schema.

    By default (in VS9 for example) all xml files use \Microsoft Visual Studio 9.0\Xml\Schemas\DotNetConfig.xsd but you can add more schemas to use.

    Before assigning a schema you must create it.

    To create a new Schema based on your own custom.config:

    1. open your custom config file
    2. in menubar XML->Create Schema
    3. save it

    To assign your schema:

    1. open your custom config file
    2. in properties panel: click on the browse button [..]
    3. set the 'Use' column to your recently created schema

    you can assign as many you want. or have one schema for all your different custom .config files

    (Sorry, but my English is not so good)

提交回复
热议问题