Sitefinity CLI
Overview
You use Sitefinity CLI to upgrade your project running on Sitefinity CMS version 10.0 or higher.
We recommend that you always upgrade to the latest version.
For information about the supported Sitefinity CMS versions, see Sitefinity Life Cycle Policy Guide.
This upgrade approach has the following main advantages:
- Sitefinity CLI automatically handles broken or missing references.
- The target framework of the upgraded project is automatically set to the relevant Sitefinity CMS framework version.
- Sitefinity CLI automatically fixes binding redirects.
- All Sitefinity projects in the solution are automatically upgraded without the need to manually go through them.
- You can include it as a step in a Continuous integration pipeline.
PREREQUISITES:
- Sitefinity CLI only supports 64-bit Windows operating systems.
- To be able to use Sitefinity CLI for upgrades, your project must be based on NuGet packages.
- You have backed up your project and its database.
- You must have installed the .NET framework version that is compatible with the Sitefinity CMS release you are upgrading to. For more information, see Sitefinity CMS and .NET framework compatibility.
- You have reviewed the API changes relevant for your upgrade path. For more information, see API changes in Sitefinity CMS.
Install Sitefinity CLI
Install Sitefinity CLI from Sitefinity GitHub repository » Sitefinity CLI.
IMPORTANT: When you run Sitefinity CLI, we recommend that you keep the project under source control, because there is no rollback mechanism in case something goes wrong.
You must not close the Visual Studio that is opened by Sitefinity CLI, because this will cancel the upgrade.
Upgrade using Sitefinity CLI
Run Sitefinity CLI and enter an upgrade command with the following syntax:
sf upgrade "{{path to the solution you want to upgrade}}" "{{version you are upgrading to}}"
Note that entering a specific Sitefinity CMS version is optional. In case you do not provide a version option, the latest version available will be used for the upgrade.
EXAMPLE: Run Sitefinity CLI and enter the following command:
sf upgrade "D:\TestProject\SitefinityWebApp.sln" "14.4.8100"
The upgrade command has the following optional parameters:
-nc
| --nugetConfigPath
This option allows you to use a custom NuGet feed that is different than the default feeds. By default, Sitefinity CLI uses http://nuget.sitefinity.com
and https://nuget.org/api/v3/index.json
.
When using -nc
or --nugetConfigPath
parameter, you should provide the path to NuGet.Config
file, in which the NuGet sources are listed.
EXAMPLE: Run Sitefinity CLI and enter the following command:
sf upgrade "D:\TestProject\SitefinityWebApp.sln" "14.4.8100" --nugetConfigPath "D:\TestProject\NuGet.Config"
--acceptLicense
This option accepts Sitefinity EULA.
EXAMPLE: Run Sitefinity CLI and enter the following command:
sf upgrade "D:\TestProject\SitefinityWebApp.sln" "14.4.8100" --acceptLicense
If you use this parameter, you automatically accept Sitefinity CMS license agreement and do not have to explicitly accept it. You can find the license after the upgrade in the Licenses folder in the Sitefinity package. For example, ~\packages\Progress.Sitefinity.MobileFormats.14.4.8100\LicenseAgreements
.
IMPORTANT: Using this parameter means that you automatically accept the license agreement and any changes included in it. If you do not agree to the new license, you must uninstall the product.
--skipPrompts
This option skips all warning prompts during the upgrade. You can use it, if you want the upgrade to run without the prompt that warns you to keep the project under source control.
--removeDeprecatedPackages
This option аutomatically removes deprecated packages during the upgrade process to ensure a clean and up-to-date codebase.
Result
When you run the command, the specified version of NuGet packages is downloaded in the folder of the solution. You are prompted to accept the license agreement. A new Visual Studio instance is launched and a NuGet command to install the NuGet packages is started. The upgrade
command modifies the references in the .csproj
project and binding redirects, if needed. The upgrade
command modifies references for Sitefinity projects only.
Once Sitefinity CLI has completed the upgrade process, make sure to rebuild your project.
NOTE: When you upgrade monolingual projects, make sure to reindex all frontend indices. If the indices are not reindexed, they could return two records for the same item - one with culture and one without.