All Articles

Setting up Unicorn on a Sitecore solution


Unicorn is a utility for Sitecore that solves the issue of moving templates, renderings, and other database items between Sitecore instances. This becomes problematic when developers have their own local instances - packages are error-prone and tend to be forgotten on the way to production. Unicorn solves this issue by writing serialized copies of Sitecore items to disk along with the code - this way, a copy of the necessary database items for a given codebase accompanies it in source control.

Steps for setup

I started on the Unicorn setup on a Sitecore 9.2 solution. You can find my base solution with all the setup made here -

  1. I am following Helix principles. So, I have my Project folder created with my base solution where I have replaced the Web.config and the Global.asax in this project with the ones in the website folder.

Project Base

  1. Setup Unicorn as as Foundation project.
  • Create a Foundation folder in the solution.
  • Add a web project under the folder. Call it Foundation.Unicorn.

Unicorn Foundation

  1. Go to the NuGet Package Manager and search for Unicorn.

Unicorn NuGet

  1. Install the Unicorn package on the created project Foundation.Unicorn.
  2. This will add references to the core DLLs and also a few config files under the App_Config folder.
  3. Disable copy for Web.config in the project during Publish. (Not to override the site’s Web.config during the Publish).
  4. Create a Publish Profile and publish the project to your site folder.
  5. Now, go and access https://your-site/unicorn.aspx
  6. Upon logging in as admin, you should be seeing a dashboard that says there are no configurations.

Strangely in my case, I wasn’t logged in again and again. Despite my attempts of logging in.

After checking several times, I realized this was happening due to the Identity Server.

Setting up Unicorn for the Identity Server configuration

  1. Under App_Config/Include/Unicorn folder, there will be a config file named Unicorn.UI.IdentityServer.config.disabled.
  2. Enable this file by renaming it (Remove .disabled from the file name).
  3. Publish this change to the site.
  4. Voila!! Unicorn login now works.

Setting up a configuration for Unicorn

I will be adding a configuration for serializing the Languages in my site.

Add the serialization config file in the solution. I have added the config in the Project layer as I am serializing the languages in the site.

Serialization config


<?xml version="1.0"?>

<configuration xmlns:patch="" xmlns:role="">
        <configuration name="Project.Languages" description="Project.Languages">
          <targetDataStore physicalRootPath="$(sourceFolder)\Project\serialization\Languages" />
            <include name="Languages" database="master" path="/sitecore/system/Languages" />


<configuration xmlns:patch="">
    <sc.variable name="sourceFolder" value="D:\Projects\Repo\Sitecore9.2"/>

Open the Unicorn dashboard and perform an Initial Serialization for the config added.

After this, the YML files for these items will be added in the target folder mentioned in the config.

Example YML file

ID: "af584191-45c9-4201-8740-5409f4cf8bdd"
Parent: "64c4f646-a3fa-4205-b98e-4de2c609b60f"
Template: "f68f13a6-3395-426a-b9a1-fa2dc60d94eb"
Path: /sitecore/system/Languages/en
DB: master
  - ID: "06d5295c-ed2f-4a54-9bf2-26228d113318"
    Hint: __Icon
    Value: Office/32x32/flag_generic.png
  - ID: "60669e54-7b9c-4b55-a0c4-8f25059d8b94"
    Hint: Dictionary
    Value: "en-US.tdf"
  - ID: "9c6106ea-7a5a-48e2-8cad-f0f693b1e2d4"
    Hint: __Read Only
    Type: Checkbox
    Value: 0
  - ID: "c437e416-8948-427d-a982-8ed37ae3f553"
    Hint: Iso
    Value: en
  - ID: "dec8d2d5-e3cf-48b6-a653-8e69e2716641"
    Hint: __Security
  - Language: en
      - Version: 1
          - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
            Hint: __Created
            Value: 20140905T080958Z
          - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
            Hint: __Created by
            Value: |

Also, if we check the serialized items in the Sitecore content tree. The items will be decorated with the Configuration, Predicate and the Path to the physical YML file.

Serialized item


  1. Unicorn GitHub solution -
  2. My solution on GitHub -

Published Dec 1, 2019

Sitecore MVP Technology 2024-23. Web Developer with rich experience in Sitecore and ASP.NET MVC.