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.
I started on the Unicorn setup on a Sitecore 9.2 solution. You can find my base solution with all the setup made here - https://github.com/mrvinaykj/sitecore-92-base
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.
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.
Project.Languages.Serialization.config
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore>
<unicorn>
<configurations>
<configuration name="Project.Languages" description="Project.Languages">
<targetDataStore physicalRootPath="$(sourceFolder)\Project\serialization\Languages" />
<predicate>
<include name="Languages" database="master" path="/sitecore/system/Languages" />
</predicate>
</configuration>
</configurations>
</unicorn>
</sitecore>
</configuration>
Variables.config
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<sc.variable name="sourceFolder" value="D:\Projects\Repo\Sitecore9.2"/>
</sitecore>
</configuration>
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
SharedFields:
- 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
Value:
Languages:
- Language: en
Versions:
- Version: 1
Fields:
- ID: "25bed78c-4957-4165-998a-ca1b52f67497"
Hint: __Created
Value: 20140905T080958Z
- ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
Hint: __Created by
Value: |
sitecore\Admin
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.