14

I have seen and experienced problems with app.config/web.config where I had changed the order of elements and the app stopped working. I believe I fixed the problem by looking at machine.config and following the order in there.

One example is the following question: Common.Logging config exception

The issue was resolved by changing the order the elements appear in the file.

So, the question is, does the order of elements matter?

It appears to me it does. If it does, is it documented anywhere, an xsd schema maybe?
Community
  • 1
  • 1
Klinger
  • 4,900
  • 1
  • 30
  • 35

2 Answers2

11

It appears that at least for the configSections element order does matter.

Document http://msdn.microsoft.com/en-us/library/ms228256.aspx states the following:

"If the configSections element is in a configuration file, the configSections element must be the first child element of the configuration element."

I got this from here: http://social.msdn.microsoft.com/Forums/en-US/clr/thread/60c7b502-f7fc-49e9-b4b0-771b4fb4134e

Klinger
  • 4,900
  • 1
  • 30
  • 35
1

here you have the entire explanation of the web config. the order and the requiered tag.

http://msdn.microsoft.com/en-us/library/ackhksh7(vs.71).aspx

JAiro
  • 5,914
  • 2
  • 22
  • 21