-
Notifications
You must be signed in to change notification settings - Fork 117
Upgrading to Unicorn 3
Kam Figy edited this page Jul 31, 2015
·
5 revisions
Unicorn 3 is a pretty major upgrade from v2. A significant amount of the default configuration has changed with new and different dependencies. The good news is that most of the commonly used configuration remains the same.
Because Unicorn 3 uses a new serialization format and filesystem organization, you will need to reserialize ALL items that are stored in Unicorn. Before starting the upgrade, make sure you've got a master copy of the latest serialized items synced into your database and ensure that no other developers are making item changes until you're done upgrading and have committed the new items.
There are also some engine changes that you should be aware of:
- Unicorn 3 uses Rainbow's Serialization File System trees by default. These trees are rooted on disk at the root item selected in Sitecore, as opposed to the root in Sitecore. For example if you included
/sitecore/content/foo
, in master, Unicorn 2 would put this in$(serializationRoot)/master/sitecore/content/foo.item
, whereas Unicorn 3 creates a tree for each include so$(serializationRoot)/foo/foo.item
(you can change the name of thefoo
folder by adding aname
attribute to your predicate entry). - SFS trees are "solid," meaning that you cannot have any tree nodes that do not have a serialized item. This is generally not a problem, but be aware that it means that the predicate only supports path-based includes and excludes. Unicorn 2 supported item ID and template ID-based predication as well.
- Unicorn 3's default configuration filters out the following fields from being serialized:
Last run
field on Schedule template,__Originator
,__Revision
,__Updated
,__Updated by
. This is generally appropriate for serializing development artifacts but may be undesirable if you're versioning any user content.
Sound good? Let's start the upgrade.
- Make sure you have synced the latest serialized items from Unicorn 2 into your database, and freeze item changes by others
- Upgrade the Unicorn NuGet package to 3.0. This will pull in the dependencies (Rainbow, Rainbow.Storage.Sc, and Rainbow.Storage.Yaml)
- Run a build of your solution in Visual Studio, to ensure the updated Unicorn assemblies are deployed
- Unicorn 3 uses a new configuration setup, where its config files reside in
App_Config/Include/Unicorn
. Review theUnicorn.config
file and transfer your settings from the oldSerialization.config
into it - specifically, your configuration(s). A diff tool such as Beyond Compare is great here. If you've customized dependencies other than the predicate in your configurations, or have customized default dependencies, review each one to see if it is compatible with Unicorn 3's dependency model as a number of namespaces have changed. If you're wondering where something went, tweet @kamsar and I'll help you out. - Take special note in your config of what the
targetDataStore
'sphysicalRootPath
is set to, because its semantics are different from the Unicorn 2rootPath
. It is not recommended to use the Sitecore default serialization location (`$(dataFolder)\serialization') for Unicorn 3, because of the different format. Choose a root path that makes you happy. - Delete the old Serialization.config, as it is no longer used. Take note also of the other config files in the
Unicorn
folder as well, as you should remove some in deployed scenarios or if you don't want the feature they provide - there are comments to help you decide. - Open the Unicorn control panel (
/unicorn.aspx
by default) and perform a reserialization of all configuration7