Install Sitecore Command Line Interface

Abstract

Procedures for installing Sitecore Command Line Interface (CLI) in PowerShell.

Sitecore Command Line Interface (CLI) is a tool that you install in PowerShell. You can install Sitecore CLI either as a local tool for individual projects or as a global tool for all projects.

Note

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

Sitecore CLI requires that .NET Core is installed on your workstation. 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 either a local project tool or a global 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 as a local project tool:

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

    Note

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

  4. Alternatively, run the following commands to install 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

    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 '2.0.0') was successfully installed.
  5. Verify that Sitecore CLI is working by typing sitecore (remember to go to your project folder if you installed Sitecore CLI as a local tool).

    If 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