We had a Sitecore 9 solution that required the include files to be rearranged to align with a new azure deployment/provisioning setup using Terraform and to fix some duplication and inconsistencies.
Problem – Unicorn Sync Failed
When we enabled unicorn sync in the CD pipeline (see here for more details about Unicorn) the deploy failed?
Unfortunately (see image above) the configuration relating to the unicorn’s sc.variable‘s were missing?
Don’t have 2 <sitecore> elements
If there are 2 <sitecore> elements in a sitecore include file, even if they have mutely exclusive require statements Sitecore’s config merge ignores the file, without reporting an error!
There are 2 solutions to the problem
- Split the configuration into 2 files each with their own <sitecore> element.
- Merge the 2 <sitecore> elements into one element and move the require constraints to each sub element.
We decided to solution 2, see the result below.
Use patch:before=”prototypes” that way the new variables are shown at the top when showconfig.aspx is used (see image below) instead of half way down the page.
I hope this will help and no one else has to waste hours figuring this out, cheers Alan