Contact Us
Introduction
Sitecore Content Serialization (SCS) is a system to serialize, share, and deploy content items and keeping them in version control. This functionality is designed to help teams of developers that work on the same Sitecore solution to synchronize database changes between their individual development environments.

Serialization functionality in Sitecore has been there for a long time. The release of Sitecore 10 has launched eye-catching features in its updated OOTB serialization. The changes introduced in Sitecore version 10 are developer-focussed that lay emphasize on proper implementation of serialization.

In the earlier versions, developers used multiple tools such as TDS, Unicorn, Sitecore Packages to share the items while working in a team. In Sitecore 10 version, dependency on other Version Control System such as Unicorn has been eliminated. Now, the .YAML format has been introduced for each item.

Sitecore Content Serialization (SCS) comes with JSON based configurations in which we have certain options to configure/choose while including and excluding the items.

 

Modes to Serialize

Combining the best of TDS and Unicorn, SCS gives us the flexibility to move the content between environments. For this, we have two different tools mentioned below :

  1. Sitecore CLI - A Command line tool to interact with your Sitecore Instance.
  2. Sitecore for VS -A graphical tool to interact with Sitecore using Visual Studio.

    Sitecore CLI Vs Sitecore using Visual Studio

  3. Install Sitecore Management Service

     

    You must install the Sitecore Management Service package to your CM instance and you can download the package from Sitecore CLI Download page and directly install this package to Sitecore Instance.

 

Sitecore Management Service Installation Package

 

Install Sitecore CLI

Before installing CLI, make sure you have installed 3.1 version of .Net Core because the

"dotnet new-tool manifest"

command is available only in .Net Core 3+ version.

Create a new project in Visual Studio and make sure you follow the Helix Architecture and go to the Project folder

(C:\Users\rohanb\source\repos\Example10)

in my case and open the PowerShell in administrator mode and run the following commands :

dotnet new tool-manifest

dotnet tool install Sitecore.CLI --add-source https://sitecore.myget.org/F/sc-packages/api/v3/index.json

# To install the Sitecore CLI as a global tool (not recommended):

dotnet tool install Sitecore.CLI -g --add-source https://sitecore.myget.org/F/sc-packages/api/v3/index.json

 

Install Sitecore CLI Commands

After successful installation, you can verify it using

"dotnet sitecore"

because as per Sitecore installation document, you have to hit only

"sitecore"

but it throws an error.

Sitecore CLI Commands for Installation

Login to Sitecore Instance with SCLI Interface

There are two ways to login into Sitecore using SCLI-

  1. An interactive user login, using device code flow.
  2. A non-interactive client login, using client credentials flow.

Interactive User Login

Before logging into Sitecore, we have to initialize SCLI as mentioned below:

  • Open the Powershell in administrator mode and go to the Project Folder and run the following command-

"dotnet sitecore init"

  • As you hit this command in the file system, you can see the sitecore.json file and .sitecore folder.

Sitecore CLI Interactive User Login

  • Now, login into sitecore and run this command (change the parameters accordingly)-

"dotnet sitecore login --auth
https://sc10identityserver.dev.local --cm
https://sc10sc.dev.local --allow-write true"

  • Once you hit this command, a Sitecore login window will start opening in your browser and click Yes, Allow.

Running Sitecore CLI Commands

Sitecore login window

  • Now create a file under your project folder Serialization.modules.json in my case and add the following details:

Creating Files Under Project in Serialization Modules

Remember, if you are adding multiple paths then do have the templates on the top else you will get an error while deserialization.

  • After setting all this, use the below serialization command for the push & pull activities where ‘ser’ is the shorthand for the serialization keyword. After running the pull command, you can see the YML files in file system.

"dotnet sitecore ser pull"
"dotnet sitecore ser push"

dotnet sitecore serialization pull

dotnet sitecore serialization push

  • For other command or the help section, run the command as mentioned below:

"dotnet sitecore --help"

Sitecore CLI command or the help section

Need Help?

Conclusion:

The fact that SCS is a more developer-friendly format, Sitecore 10 content serialization allows to transform data items to text files or memory buffers for their future storage, transfer and reconstruction. It is especially useful for a team of developers who work together on the same project and need to seamlessly synchronize changes between their individual development environments. Few cases in which Serialization is better than Packaging are :-

  • There is no size limit in serializing the items but while creating Sitecore Packages, there is a size limit of 2GB only.
  • There are no revert option in Sitecore Packaging, once you have installed the item package you will lose the changes which you don't want to but with the serialization you can anytime revert the changes (use revert item or revert tree) and get back to the initial state of the content item.

Happy Serializing!!

Publications
& Thought Leadership

Publication
Using PowerShell to Change Sitecore SXA Rendering Variants
Learn how to utilize PowerShell script to modify a rendering variant in Sitecore and customize your website’s layout and design.
Picture2
Webinar
The 3 Flavors of Sitecore Cortex - How Machine Learning helps Marketing
Join us to learn more about the features and hear what you need to do to get there as well as how Sitecore clients are employing Machine Learning on their websites today.
The 3 Flavors of Sitecore Cortex - How Machine Learning helps Marketing image
Publication
How to Create a Sitecore JSS-NextJS Application Using JSS CLI
Empower your web development with Sitecore JSS Next.js. Create reusable components, dynamic routing, and deploy independently for flexible front-end updates.
THE TOP 4 DIGITAL CX TRENDS 640x319 (3)