UNICORN Utility in SiteCore for Version Control

Why Unicorn Utility?

When developing on your local Sitecore you want probably versioning and backup you’re Templates, layout, and other Sitecore items, and synchronize the master and core database with the other developers on the project.


Unicorn is a utility for Sitecore that solves the issue of moving templates, renderings, and other database items between Sitecore instances.

Unicorn is a create serialization tool for Sitecore 6.5 rev.121009 and higher. Not working on older 6.5 revisions. In the configuration you choose which items and sub items must be automatically serialized. Deserialize can be done via the unicorn admin page.

  • Sitecore items in same version system as code
  • Automatically creating packages with Sitecore Courier based on the serialized items, possible to make an Incremental packages
  • Possible to use Unicorn for deployment instead of package – Need to explore

How does Unicorn Work?

Unicorn solves this issue by using the Serialization APIs to keep copies of Sitecore items on disk along with the code – this way, a copy of the necessary database items for a given codebase accompanies it in source control.

Configuring Unicorn in Sitecore

  • Open Visual Studio, add Unicorn through NuGet Package to your Solutions.a
  • Configure what to serialize in the example configuration’s Predicate There will be an App_Config/Include/Serialization.config file installed, which has a commented example of this syntax
  • In Config file you can include & Exclude the item tree you want.

Include:- <include database=”master” path=”/sitecore/content”/>

Exclude: – <exclude path=”/sitecore/system/Marketing Center”/>

  • Run a build in Visual Studio to make sure the output files are up to date.
  • Publish the site.
  • Open $yoursite/unicorn.aspx, once the Control Panel open you see the initial serialization button. This Item will serialize all of the included items in it to disk.
  • b
  • All serialization item can be found in the default location in folder serialization of the Sitecore Data folder
  • You can change Serialization folder, By making the change in rootPath variable in config file

<serializationProvider type=”Unicorn.Serialization.Sitecore.Fiat.FiatSitecoreSerializationProvider, Unicorn”                           rootPath=”C:\amit\UnicornWeb\Unicorn\App_Data\serialization” singleInstance=”true” />

  • Commit the serialized to source control.

Using Unicorn with TFS & VS

  • Use App_Data folder in your VS solution for your sitecore data folder. Make sure you give this folder the required rights!
  • Make separate config files for each environment you are going to use.
  • Make sure you have a folder called “serialization” in your App_Data folder.
  • Serialize the Item, by going through the Unicorn Control panel, Click on Button “Reserialize the Default configuration now”, Now that you have the files on disk, you can commit them in TFS.
  • Conflicts in items are resolved at the source control level – at any given time, the disk is considered the master copy of the Sitecore items.
  • If you make any changes in Sitecore Content item Tree, The Item will get automatically check Out in Visual Studio.
  • If you want to update/Add the Item from TFS, You need to click on “Sync Default Configuration Now” of Unicorn Control panel. This automatically update the Sitecore Tree.


Automated Deployment

It Help you deployed the Serialiazed file using PoweShell. This also help you in deploying on CI Server.

To get our items to be deployed required two things

  • Add the below line in AppSetting of Sitecore Web.config file.

<add key=”DeploymentToolAuthToken” value=”{GUID OR TOKEN HERE}”/>

  • Called the below script in PoweShell.

$url = 'http://your-site-authoring-url/unicorn.aspx?verb=Sync'

$deploymentToolAuthToken = ‘generate-a-long-random-string-for-this’

$result = Invoke-WebRequest -Uri $url -Headers @{ “Authenticate” = $deploymentToolAuthToken } -TimeoutSec 10800 -UseBasicParsing

Write-Host $result.Content

  • If it is successful, you will get the below screen.





Sitecore Serialization Guide


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.