Sitecore provides a command line tool that can be used for development efficiency and operation. In this article, we will show you how to install this tool, Sitecore CLI.
Sitecore Command Line Interface
The following sites provide help documentation on how to use the command line interface.
The following blog also provides information on the verification procedure.
- Sitecore CLI を使用する パート1 インストール ( Japanese )
- Sitecore CLI を使用する パート 2 動作確認 ( Japanese )
Unlike the above article, Sitecore CLI has already been released 4.1.0 as of the publication of this blog post.
We will introduce 4.1.0 on this blog.
Prerequisite.
Sitecore CLI 4.1.0 can be used in the following environments
- Use in combination with Sitecore 10.1 and 10.2
- Sitecore Management Services must be installed
- .NET Core 3.1- PowerShell
If you go to the Sitecore CLI NuGet Package site, you will see that .NET Core 3.1 is the target.
Preparation for Installation
NET Core 3.1 is installed if you have already installed Visual Studio or other software. However, if you have not installed it, you can download the module from the following site
The operating environment is now ready.
Install
It is recommended that the Sitecore CLI be installed on a per-project basis. This is because the version of the Sitecore CLI may differ depending on the target Sitecore version. For this reason, we will install it in a local project.
cd <project folder>
dotnet new tool-manifest
dotnet nuget add source -n Sitecore https://sitecore.myget.org/F/sc-packages/api/v3/index.json
Running dotnet new tool-manifest will create a .config folder. dotnet nuget add source -n Sitecore is not required if it has been run once before.
Then install the command.
dotnet tool install Sitecore.CLI
The command is now installed.
Project Initialization
From here, we will perform the initial setup of the project. First, start configuring the Sitecore CLI commands.
dotnet sitecore init
Doing so will add some data.
- .sitecore folder
- sitecore.json
- .gitignore
- .vscode\settings.json
Install the Sitecore CLI plugin, available in 4.1, for the following items
- Sitecore.DevEx.Extensibility.Serialization
- Sitecore.DevEx.Extensibility.Publishing
- Sitecore.DevEx.Extensibility.Indexing
- Sitecore.DevEx.Extensibility.ResourcePackage
This time we will install the serialize and publish plug-ins.
dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.Serialization
dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.Publishing
The following commands can be used to check the installed plug-ins.
dotnet sitecore plugin list
Summary
We have introduced the installation of Sitecore CLI. We will discuss how to use the tool in another article, but please install Sitecore CLI as much as possible, as we will be using it in our blog from now on.