With Sitecore 9, Sitecore has introduced the concept of configuration layers. Configuration layers provide a way to control the order and separation of user config files from the Sitecore-provided config files. The layers are defined in the App_Config\Layers.config. By default, there are four layers defined:
- Sitecore - All config files for standard Sitecore components are stored in this folder. The load order for the files in this layer should not be changed, as it will cause some features to not function normally.
- Modules - This contains the configuration files for Sitecore modules.
- Custom - This contains all the patch files needed for modifying the default values of Sitecore.
- Environment - This contains patch files that are created for non-production such as logging.
Sitecore recommends not manually modifying or adding any configs in the Sitecore and Modules layers. Also, Sitecore recommends not changing the loading order of the different layers. By default, the load order is as follows:
- System files such as Layers.config, ConnectionStrings.config
- Sitecore Layer configuration files as defined based on the LoadOrder in Layers.config
- Modules Layer configuration files
- Custom Layer configuration files
- Environment Layer configuration files
If you see ‘LoadOrder not defined’ in the Layers.config for a particular layer, Sitecore uses the default load order as specified below:
- Files in the root folder are merged before the files in the subfolders within a folder
- Sitecore loads the subfolders in alphabetical order and the files in the subfolder in alphabetical order.
LoadOrder can be used to load files in specific way.
Based on the Loadorder, it would first load Folder1 files in alphabetical order, then load specific.config in Folder2, and then load the remaining files in Folder2 in alphabetical order.
You can disable all the patch files in a layer by using the mode attribute in the layer node.
You can disable a single file/folder by using the mode attribute as shown below: