Let's say you want to temporarily exclude a .config file from being applied as a patch by Sitecore. Normally, you would either:

  • Delete the file;
  • Or rename it to have an extension different from .config.

Is there any other way of disabling a .config file? I don't want to change the file name or its contents (due to deployment process intricacies).

  • Can you just not have the file get deployed? Alternatively, can you deploy it to a different target outside of the App_Config/Include folder? Commented Oct 13, 2016 at 12:53
  • @GeorgeChang I want to keep the file deployed. I don't want to change the deployment process to not include the file. I just want Sitecore to ignore the file for now. Commented Oct 13, 2016 at 12:54
  • What are you using to deploy? OctupusDeploy? Or Gulp Scripts or Nant scripts?
    – Anicho
    Commented Oct 13, 2016 at 13:05
  • @Anicho OctopusDeploy, although it's not really relevant to the question. Commented Oct 13, 2016 at 13:05
  • Ahh okay, was going to write some powershell script to make the file hidden just in case you dont have access to the server. So it could be a step which can be turned on and off or run individually.
    – Anicho
    Commented Oct 13, 2016 at 13:12

4 Answers 4


You can set the "Hidden" file attribute. Sitecore will not patch in any hidden files, even if they have the .config extension. The same is also true for folders, setting the "Hidden" attribute will mean the folder is not processed and the files contained within will not be loaded either.

Hidden property

You can find the exact code in LoadAutoIncludeFiles() method in Sitecore.Configuration.ConfigReader class:

protected virtual void LoadAutoIncludeFiles(ConfigPatcher patcher, string folder)
    if (!Directory.Exists(folder))
    foreach (string file in Directory.GetFiles(folder, "*.config"))
        if ((File.GetAttributes(file) & FileAttributes.Hidden) == (FileAttributes) 0)
    foreach (string directory in Directory.GetDirectories(folder))
        if ((File.GetAttributes(directory) & FileAttributes.Hidden) == (FileAttributes) 0)
          this.LoadAutoIncludeFiles(patcher, directory);

NOTE: The above is decompiled code and I have modified it for berevity.

  • 1
    That's very cool. Learn something new every day. Commented Oct 13, 2016 at 12:58
  • I did not know this! Thanks @jammykam! Commented Oct 13, 2016 at 13:46
  • Good one @jammykam! Commented Oct 13, 2016 at 13:52
  • uCommerce configuration works similar to Sitecore one with one difference. A folder name ending with ".disabled" isn't processed. Sitecore could add this behavior to its logic. Commented Oct 13, 2016 at 14:09
  • Nice, learned something new today! Commented Oct 13, 2016 at 14:23

You can make your configuration file hidden, which will cause Sitecore to NOT read that configuration file.

But, don't know how to set the hidden attribute automatically from the deployment process.

One option would be, you manually set the file properties to hidden on the server/instance and then stop the already existing file deployment to that certain folder. (But, this will also introduce a problem in case you change any configuration on those files)

  • As mentioned, I don't want to change the deployment process. I just want to make Sitecore ignore the file for the time being. Which is perfectly achieved by making the file hidden (as yours and jammykam's answers suggest). Commented Oct 13, 2016 at 13:00

Wrap the context in comment tags. Or you could drop another patch file in below it to overwrite that patch. Maybe those are obvious, but figured I would throw them out anyways.

  • Along the same lines, I have used slow cheetah to add different versions of config files, including blank nodes. This way the file exists in the project, and source control, and transforms it's way out of deployment.
    – MikeD
    Commented Oct 14, 2016 at 0:14

Hoping this answer will help someone in the future, Sitecore 9 now has this feature. You can disable any config file or folder by Adding the patch file to a section and add the mode="Off" attribute. for example:

1 <add path="Sitecore.Analytics.Config" type="File" mode="Off" /> 

2 <add path="zCustom" type="Folder" mode="Off" />

for more information you can check https://doc.sitecore.net/sitecore_experience_platform/developing/developing_with_sitecore/customizing_server_configuration/disable_a_patch_file#_Disable_a_single

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.