Extend the Command Line Interface with NuGet

Abstract

Sitecore Command Line Interface (CLI) plugin command reference, used to extend the CLI with NuGet.

With NuGet extensibility, you can add different sets of plugins to your project. You can specify plugin sources in the NuGet.config file in the project directory.

Sitecore Command Line Interface (CLI) plugins are published to https://sitecore.myget.org/gallery/sc-packages.

The CLI installs all plugins in a cache in the \.sitecore\package-cache\nuget directory of the project.

Note

When cleaning the cache folder, the next CLI call restores all NuGet packages.

The CLI comes with a built-in plugin command to add, update, list, and remove plugins from your project.

Note

The version displayed in the terminal is the latest official release available.

To add or update a plugin in your project:

  • Use the following command:

    sitecore plugin add -n <name of plugin> -v <version of plugin>

    Note

    If you do not specify the version option, the CLI installs the latest version. If you specify a plugin version that is higher than already installed, the CLI updates it to the newer version.

    If the package does not exist, the CLI displays a message to inform you, for example, You have already installed version 4.0.0 of plugin Sitecore.DevEx.Extensibility.Serialization.

Options

You can use the following options with the plugin add command:

Option

Required?

Default

Description

-c, --config

No

cwd

The path to the sitecore.json configuration file.

-n, --name

Yes

Name of the plugin to install into the current project.

--version

No

The version of the plugin to install. If it isn't specified, the CLI installs the latest version.

-v, --verbose

No

Report additional diagnostic and performance data.

-t, --trace

No

Report additional diagnostic and performance data.

-?, -h, --help

No

Help for the plugin add command.

Examples

To install and add/update to the latest version of the Sitecore.DevEx.Extensibility.Serialization plugin, use the following command:

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

Output:

Successfully installed version 4.0.0 of plugin Sitecore.DevEx.Extensibility.Serialization

To install and add version 4.0.0 of the Sitecore.DevEx.Extensibility.Serialization plugin, use the following command:

sitecore plugin add -n Sitecore.DevEx.Extensibility.Serialization --version 4.0.0

Output:

Successfully installed version 4.0.0 of plugin Sitecore.DevEx.Extensibility.Serialization

To remove a plugin from your project:

  • Use the following command:

    sitecore plugin remove -n <name of plugin>

    Note

    If the plugin does not exist, the CLI displays a message to inform you, for example, The plugin Sitecore.DevEx.Extensibility.PluginDoesNotExist does not appear to be installed.

Options

You can use the following options with the plugin remove command:

Option

Required?

Default

Description

-c, --config

No

cwd

The path to the sitecore.json configuration file.

-n, --name

Yes

Name of the plugin to install into the current project.

-v, --verbose

No

Report additional diagnostic and performance data.

-t, --trace

No

Report additional diagnostic and performance data.

-?, -h, --help

No

Help for the plugin remove command.

Example

To remove the Sitecore.DevEx.Extensibility.Serialization plugin, use the following command:

sitecore plugin remove -n Sitecore.DevEx.Extensibility.Serialization

Output:

Successfully deleted version 4.0.0 of plugin Sitecore.DevEx.Extensibility.Serialization

To list all installed plugins that you can include in your project:

  • Use the following command:

    sitecore plugin list

Options

You can use the following options with the plugin list command:

Option

Required?

Default

Description

-c, --config

No

cwd

The path to the sitecore.json configuration file.

-v, --verbose

No

Report additional diagnostic and performance data.

-t, --trace

No

Report additional diagnostic and performance data.

-?, -h, --help

No

Help for the plugin list command.

Example

To show the list of plugins, use the following command:

sitecore plugin list

Output:

List of plugins: Sitecore.DevEx.Extensibility.Publishing v.4.0.0