If you have worked on Sitecore for a few weeks, then you would have come across the situation where you need to move your Sitecore content from one instance to another. Be it from your instance to your peer’s or from local instance to DEV or to UAT or may be even PROD.
Now depending upon the item count, one would have either created a package – shared it – installed those packages.
Now imagine, you have an entire content tree paired with Layouts, Renderings and templates added if you have changes in Core DB, imagine the volume of Data that needs to be moved from one instance to another. The Size of the packages would go to GBs.
Also, once you have installed and published a package, you cannot revert the item state to it’s previous state unless you have a separate physical back up of those items.
In order to overcome these difficulties, moving content from one instance to another with ease, we use serialization tools. There are many tools out there. Two of the most popular Sitecore Serialization tools include Unicorn and TDS.
TDS is not an open source. EOD. I didn’t get much chance to play around it while I write this post. So, I couldn’t comment much on setting it up, it’s ease of use and advantages over Unicorn or other tools.
Unicorn is open source, it’s developed by Sitecore Community members. It’s kind of a free alternative to TDS.
Open Source – We can get to play with it without any fees or licenses. Hence, this post.
You can find lot of articles on web over which one should you pick. Unfortunately, this article is not one of them.
In this post, we will see how we can setup Unicorn, set the content configuration, predicates and serialization folder. How we can transfer content from one instance to another.
Most of the Sitecore Solution would follow Helix Principles, under the same principle, for setting up of a serialization module, we create a separate folder under foundation named serialization and add a serialization project.

We can install Unicorn via NPM. Under, Manage NuGet Packages for the Unicorn Project search for Unicorn and install the latest stable version.

Once, it’s installed, you will see the required DLLs, App Config Folders added.

The First thing you do is Enable the IdentityServer config. Most of us must have moved to Sitecore 9.1 or above. The Identity Server config is has the necessary configs for managing the authentication formalities of Unicorn with Identity Server components.
One thing which I would like to point here is, the Site Neutral Path value is Case sensitive. /unicorn.aspx and /Unicorn.aspx is different.
So, enable this config and add the required Site Neutrals.
To Check whether Unicorn has been successfully installed, go to <<Your Sitecore Instance>>/Unicorn.aspx. You will see Unicorn Home Page. If you are being asked to sign in to Sitecore Console, sign in as Admin and Check again. If you are being circled between Sitecore login page and Unicorn Start Page asking for login, seems like Identity Server Config is not setup properly. Recheck whether you are using the same URL pattern or whether you have published your Unicorn Config changes done so far.
Now, let’s talk about other key configurations.
- Configurations: Each configurations includes predicates, sync configurations – items/Parent Items aka Folders that needs to be included for Serialization, updating the link database, search index etc.
- Predicates: Predicates include configurations for mentioning the sitecore items needed to be included for Serialization. You have options for including the parent item alone, excluding the child items and few other customizations.
- For getting started these configs would suffice. MySitecore and Mark 1 are the parent folders under respective categories that are present in my Sitecore Instance.




- We have added configurations for including the Sitecore Items. Let’s work on setting up Data Store.
Before going up further I would like tell you about Serialization Process.
“Serialization is the process of converting an object into a stream of bytes to store the object or transmit it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed. The reverse process is called deserialization.”
This is the most amazing and absolute definition for the Serialization.
Unicorn converts the Sitecore Items in Sitecore Database to Serialized State aka .YML Files.
Coming back to our Data Store discussion, Data Store is nothing but a place for storing these Serialized Data (.YML Files). So that we can make use of this data store for Serialization/Deserialization of the items.
Another key feature of Unicorn is, it let’s the Source Control handle the version management. I will explain this towards the end of this post.
- The Data Store is unique for each configurations. The Data Store is mentioned in a separate config, Unicorn.CustomSerializationFolder.config
- Just like each patch config we include for other Helix Modules, it is wise to include our custom Unicorn Configs under separate Configuration Folder. This will be helpful during Version Upgrades.
To Sum UP,

Now, after publishing the Unicorn Config changes done so far, open <<Your Instance>>/Unicorn.aspx and Do initial Serialization.
Initial Serialization is some thing that you do only when you setup the Unicorn for the first time to a instance. It Serializes the current Sitecore items and stores them the target Data Store.

Some Samples

A YML Files opened in Notepad++ having information about the item and it’s fields

Once, everything is setup as mentioned above, you will end seeing a screen similar to the one below.

Click the Show Config to check your Configurations.
Reserialize – Serializes Sitecore Items from Sitecore Content Tree to Data Store as .YML Files.
Sync – De Serializes the YML Files to Sitecore Database. Meaning whatever the state in your YML File will be moved to your Sitecore Database. Based on the Situation and requirement perform Reserialize or Sync.
That’s almost it. You can move the Serialization Folder to your source control and let it handle the version management. I would have given a heads up about this in the earlier part of this post.
Meaning,

So that, whenever you make the changes to Sitecore Item, it will be available in your changes tab.

Just like maintaining our Visual Studio files, we can mange Sitecore Content as well. In this way the Sitecore items can be moved across peers. Get the latest version of the Data Store and Perform a Sync Operation
Unicorn also provides a powershell script that can be added to your devops pipeline and the sync of Sitecore YML Files to Sitecore DEV/UAT or PROD database can be controlled along with Auto Publish option.
2 thoughts on “Sitecore – Item Serialization – Using Unicorn”