0
votes

Sitecore has a mechanism for patching include files (http://www.sitecore.net/Community/Technical-Blogs/John-West-Sitecore-Blog/Posts/2011/05/All-About-web-config-Include-Files-with-the-Sitecore-ASPNET-CMS.aspx) but I'd like to patch something in the Analytics config, which itself uses this mechanism already.

Rather than add my line to the Analytics include file, it seems cleaner to leave it in my own tiny config; but it doesn't seem to get applied (my breakpoint isn't being hit).

I'm wondering if there's a way to control the order include files are processed in Sitecore, or if this just plain doesn't work?

4
Not entirely sure if it would work - which one would be applied first? If your include gets patched first, then the Analytics.config, wouldn't that one possibly override your styles? Can you try changing the Analytics.config with your changes, then check to see if it works?Trayek

4 Answers

6
votes

It is possible and it does work - You just have to keep in mind the following:

  1. You can't add new elements to other elements added with another patch. Example: In patch A you add a new <database /> element and in patch B you want to add a new child to the new <database /> element. Updating attributes works!

  2. When you need to patch a patch, the naming of the file is important. Example: You can patch Analytics.config by creating a new config file called AnalyticsPatch.config which will then be included in the final web.config section right after the original Analytics.config.

This is tested and used in production with Sitecore versions 6.4.1 till 6.6.0 Update-4.

Happy patching :)

5
votes

You can check if your modification to the config file is applied by taking a look at the live-config:

www.yoursite.com/sitecore/admin/showconfig.aspx
3
votes

Just for info, and keeping ppl up to date:

It seems that, atleast for newer Sitecore(testet with Sitecore 7.0), it takes subfolders into the calculations. This means that all files in the root folder, /app_config/include is processed first.

Next it takes the config files from the subfolders, i.e. /app_config/include/myfolder, the stuff in myfolder will overwrite what has been configured in the root include folder.

0
votes

I ran into a situation where my custom include file was being applied before another include file, which caused unintended issues. I found that renaming my own config file to something like zz.MySettings.config did the trick.