1

I am trying to patch a file (already a patch) so that it can be loaded after that, but the patching is not working.

Below is the scenario:

  1. Create a patch config file for loading the DI configurator in the foundation layer
  2. Now trying to patch the DI configurator for a feature so that it loads after the foundation's patch file using the patch:after syntax.
  3. When I check the order in the showconfig.aspx then feature's patch is not loading after the foundation's config but it is loading before the foundation config as shown in the screenshot below.

enter image description here

FYI: below is the syntax that I have used for patching:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
    <sitecore>
      <services>
         <configurator type="DDD.Feature.Documents.Pipelines.RegisterGenericTypes, DDD.Feature.Documents" patch:after="*[@type='BBB.Foundation.DependencyInjection.Infrastructure.MvcControllerServicesConfigurator,BBB.Foundation.DependencyInjection']"/>
      </services>
    </sitecore>
</configuration>

But if I do patch:before or patch:after for any sitecore type then it works. For example, in the screenshot you can see the top line like Sitecore.Services.Infrastructure.Sitecore.DependencyInjection....., if I will do path:after or patch:before for it then patching works.

I am not sure if patching an already patched file is allowable or not. If so then please let me know where am I making the gap in the config?

Even I checked the loadOrder it seems to be fine as following:

<layer name="Custom" includeFolder="/App_Config/Include/">
    <loadOrder>
      <add path="Rainbow.config" type="File" />
      <add path="Unicorn" type="Folder" />
      <add path="Foundation" type="Folder" />
      <add path="Feature" type="Folder" />
      <add path="Project" type="Folder" />
    </loadOrder>
  </layer>
7
  • Are your files properly added in the correct folder? Commented Jul 1, 2020 at 18:10
  • Try moving the config to a zzz.Last folder and check if the patching order is correct. It will let you know if it's an issue with the config or load order.
    – jammykam
    Commented Jul 1, 2020 at 19:17
  • Yes file is in Foundation folder @Hishaam Commented Jul 2, 2020 at 3:05
  • @jammykam, I noticed one thing that if move file from Foundation folder to Feature folder then it patchhing works in correct load order. Any idea why is this not working with Foundation folder. Commented Jul 2, 2020 at 3:07
  • 1
    Prashant, Can you please let me know which Sitecore version - are you using? Because i believe loadOrder concept came after Sitecore 9. Commented Jul 2, 2020 at 5:39

1 Answer 1

2

Since the loadOrder concept was introduced in Sitecore 9.x that is why LoadOrder not working as expected for your 8.2.

So please try considering configs to be loaded in alphabetical order.

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.