How to do Configuration patching in Sitecore

In Real development many time we find lot of scenario where we have to patch the configuration. In Sietcore there is one thumb rule that all type of patching configuration file will add under “\App_Config\include” folder.

All given below patch section will add only under <sitecore> tag in config file. Sitecore have custom module which dynamically added all configuration at runtime.

Following are some requirements and examples.

  • Merging the config files: -A

    s example in Sitecore all setting will exist in Sitecore.config file under Include folder.

As example if you want to create a switcher for any logic that you can enable and disable the execution of code from configuration.

Create one new config File name as “z.SitecoreSetting.config” and add setting in this file as follows:

<setting name=”SwitchOnOff” value=”true” /> 

Note: At run time this setting will be add in Sitecore.config file.

  • How to add or update attribute of any configuration: – We can add the new attribute or update the existing attribute value also.

As example you got the requirement from Client that language will not append in Web URL.

Following are the step to implement this:

Create one new config File name as “z.SitecoreLinkManger.config” and add setting in this file as follows:

You have to add  “patch:attribute” tag containg the name of existing attribute and new value.

“<configuration  xmlns:patch=”; xmlns:set=””&gt;


<linkManager defaultProvider=”sitecore”>


<add name=”sitecore”>

<patch:attribute name=”languageEmbedding”>never</patch:attribute>







  • How to insert the config element before or after specific configuration?

In this requirement we have to add out custom pipeline, events or etc. Please see the below httpbegin request pipeline example.

Patch:before  Example

<configuration xmlns:patch=””&gt;




<processor type=”Your custom class name”,   DLL Name”      patch:before=”processor[@type=’Sitecore.Pipelines.HttpRequest.LayoutResolver, Sitecore.Kernel’]”/>






patch:after Sitecore Example:-


<!– Sitecore.config –>


<processor type=”test1″ />

<processor type=”test2″ />

<processor type=”test3″ />


<!– Patch file –>


<processor type=”testA” patch:after = “processor[@type=’test2′]”/>


The configuration used at runtime is:

<test>  <processor type=”test1″ />

<processor type=”test2″ /><processor type=”testA” />  <processor type=”test3″ />


<processor type=”test2″ />

<processor type=”testA” />

<processor type=”test3″ />



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s