Bug in Sitecore web.config Include Files
Take care when adding an include file for your Sitecore web.config. These are the files located at your [siteroot]\Website\App_Config\Include, and John West writes about it on his blog here succinctly and articulately, just like every other piece of writing he does on Sitecore.
However, there is a danger if you are trying to insert an XML element without any attributes using an include file! If you do so, the first sibling of your newly inserted node will be removed! The workaround is to add an arbitrary attribute that your application can simply ignore.
For example, look at the following include file that I included at [mysiteroot]\Website\App_Config\Include\Awesome.config:
The web.config has the following at its /sitecore/ui/usings node
Then if we visit the expanded web.config which we can view at [yoursite.com]/sitecore/admin/showconfig.aspx, the first node is gone!
Talk about annoying! However, if you put in an arbitrary attribute like so
You won’t get any unintended side effects!
Be careful! I’m sure I will have future posts on traps you should be wary of when working with the Sitecore web.config!
comments powered by Disqus