2

I have Helix-Habitat based solutions which contains lots of Foundation and Feature projects. I want to set a sequence / order of modules to perform Unicorn sync.

Can anybody guide me here?

3

You need to use

dependencies="Foundation.Serialization,Foundation.Indexing"

notation in your Unicorn config files.

So if you need module Feature.Navigation to be dependent on Foundation.Serialization,Foundation.Indexing modules you would make it like this

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
    <unicorn>
    <configurations>
        <configuration name="Feature.Navigation" description="Feature Navigation" dependencies="Foundation.Serialization,Foundation.Indexing" patch:after="configuration[@name='Foundation.Serialization']">
        <targetDataStore physicalRootPath="$(sourceFolder)\feature\navigation\serialization" type="Rainbow.Storage.SerializationFileSystemDataStore, Rainbow" useDataCache="false" singleInstance="true" />
        <predicate type="Unicorn.Predicates.SerializationPresetPredicate, Unicorn" singleInstance="true">
            <include name="Feature.Navigation.Templates" database="master" path="/sitecore/templates/Feature/Navigation" />
            <include name="Feature.Navigation.Renderings" database="master" path="/sitecore/layout/renderings/Feature/Navigation" />
        </predicate>
        <roleDataStore type="Unicorn.Roles.Data.ReverseHierarchyRoleDataStore, Unicorn.Roles" physicalRootPath="$(sourceFolder)\feature\navigation\roles" singleInstance="true"/>
        <rolePredicate type="Unicorn.Roles.RolePredicates.ConfigurationRolePredicate, Unicorn.Roles" singleInstance="true">
            <include domain="modules" pattern="^Feature Navigation .*$" />
        </rolePredicate>
        </configuration>
    </configurations>
    </unicorn>
</sitecore>
</configuration> 

Unicorn will automatically determine order of projects / modules based on this configuration therefore Foundation.Serialization and Foundation.Indexing modules will be synced first and then Feature.Navigation.

You can also use wildcards and set dependencies this way:

dependencies="Foundation.*"

which will automatically push current module to be synced after all Foundation one.

You can see more examples on how to set dependencies in Unicorn in this example config file in Unicorn GitHub.

Sample configuration for this example / answer was taken from Helix documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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