Upgrade the Sitecore Command Line Interface to version 5

Version: 10.2

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

Note

If you do not have a previous installation of the CLI in your project, follow the steps to install Sitecore Command Line Interface instead.

Before you begin

Make sure you are using Sitecore Headless Services version 20.0.2 or higher.

Steps

To upgrade an existing CLI installation:

  1. Update the Sitecore Management Services module.

    Important

    This is an important step because starting with version 5.1.25 the CLI has a version compatibility feature that prevents you from running CLI commands with an outdated version of Sitecore Management Services.

  2. Update the CLI version:

    RequestResponse
    dotnet tool update sitecore.cli --version {version}
    Note

    To update to the latest available version, you can use the command without providing a version: dotnet tool update sitecore.cli.

  3. Update the default plugins:

    RequestResponse
    dotnet sitecore plugin init

    Alternatively, update or add each plugin manually:

    RequestResponse
    dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.Serialization --version {version}
    dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.Publishing --version {version}
    dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.Indexing --version {version}
    dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.ResourcePackage --version {version}
  4. If you want to install the Database plugin, run the following command:

    RequestResponse
    dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.database --version {version}
  5. If you want to install the XM Cloud plugin, run the following command:

    RequestResponse
    dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.XMCloud
  6. Check the Sitecore CLI version using the following command:

    RequestResponse
    dotnet sitecore --version

    If your CLI is updated successfully, it returns the version you specified. For example 5.1.25.

  7. To update the JSON schema, run the following command in your project folder:

    RequestResponse
    dotnet sitecore init
  8. Check the installed plugins using the following command:

    RequestResponse
    dotnet sitecore plugin list
    

    If your CLI plugins are updated successfully, it returns the following message:

    RequestResponse
    Sitecore.DevEx.Extensibility.Database v.{version}
    Sitecore.DevEx.Extensibility.Indexing v.{version}
    Sitecore.DevEx.Extensibility.Publishing v.{version}
    Sitecore.DevEx.Extensibility.ResourcePackage v.{version}
    Sitecore.DevEx.Extensibility.Serialization v.{version}
    

Do you have some feedback for us?

If you have suggestions for improving this article,