Install Sitecore Command Line Interface

Abstract

How to install Sitecore Command Line Interface (CLI) in PowerShell.

Sitecore Command Line Interface (CLI) is a tool that you install in PowerShell.

Note

To upgrade an existing CLI installation, see Upgrade Sitecore Command Line Interface.

You can install Sitecore CLI either as a local tool for individual projects or as a global tool for all projects.

Important

We do not recommend installing Sitecore CLI as a global tool. Different Sitecore instances might need different versions of the Sitecore CLI.

You must have .NET Core installed on your workstation before installing the Sitecore CLI. If you do not have the required version of .NET Core installed, you get the following message:

It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '<major.minor>' was not found.

To install Sitecore CLI as as a local project tool:

  1. If you have not already done so, install Sitecore Management Services.

  2. Open a PowerShell with administrator privileges.

  3. Run the following commands to install Sitecore CLI:

    cd <project folder>
    dotnet new tool-manifest
    dotnet nuget add source -n Sitecore https://sitecore.myget.org/F/sc-packages/api/v3/index.json
    dotnet tool install Sitecore.CLI 

    Note

    Other developers working on the same project only need to run dotnet tool restore to install Sitecore CLI.

    To install the CLI globally, use the -g option when running the install command (not recommended).

    After the installation has completed successfully, you get the following message:

    You can invoke the tool using the following command: sitecore
    Tool 'sitecore.cli' (version '3.0.0') was successfully installed.
  4. To initialize your new project, run the following command in your project folder:

    sitecore init
  5. Install the required Publishing and Serialization plugins:

    dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.Serialization
    dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.Publishing

    Note

    The Publishing and Serialization commands became separate plugins as part of the Sitecore CLI NuGet extensibility release.

    You can check the installed plugins using the dotnet sitecore plugin list command:

    List of plugins:
    Sitecore.DevEx.Extensibility.Publishing v.3.0.0
    Sitecore.DevEx.Extensibility.Serialization v.3.0.0
  6. To verify that the Sitecore CLI works, go to your project folder in a terminal and type sitecore.

    If the Sitecore CLI is ready, you get the following message:

    Required command was not provided.
    
    Usage:
      sitecore.cli [options] [command]
    
    Options:
      --version    Display version information
    
    Commands:
      login                  Authenticates the CLI to a Sitecore instance
      publish                Performs a publish operation on all content
      ser, serialization     Item serialization commands
      init                   Creates Sitecore configurations in current directory