Sitefinity CLI: The Recommended Way to Upgrade Sitefinity

Sitefinity CLI: The Recommended Way to Upgrade Sitefinity

February 03, 2021 0 Comments
Sitefinity CLI Upgrade
We’ve taken automation up another notch when it gets to installing upgrades to your Sitefinity project. If you’re running Sitefinity 10.0 or above, the Sitefinity Command Line Interface (CLI) is the new fast lane to upgrading your websites and applications.

Upgrades. We’ve been over this before. I guess we all agree that a certain amount of upgrade anxiety is a given. And it’s not as simple as "if it ain't broke, don't fix it." As in every software system, the upgrade process is an inevitability that shouldn’t be taken lightly. Big projects, multiple dependencies, custom code—it takes careful planning, precise execution and a fair amount of time and resources.

Then, ultimately, the question of how much control we have over the process. And the result. Alright, upgrading is a complex process involving multiple operations with potentially plenty of loose ends to keep track of. But hey, does it have to be hard or intimidating? Complex isn’t necessarily equal to complicated.

Upgrades via Sitefinity CLI: Automatic for the People

At Sitefinity, we are constantly trying to automate many aspects of the upgrade process. Our customers in the cloud are already enjoying automated Sitefinity upgrades. For those of you on-premises or self-hosted deployment, we want to encourage you too to always take advantage of the latest performance, productivity and security enhancements each new version brings. We want you to proceed with confidence, not fear. So, here’s the deal—upgrading Sitefinity has never been simpler.

The Sitefinity CLI now supports upgrades to the latest version for projects running on Sitefinity CMS 10.0 and above. The Upgrade CLI will automatically install NuGet packages, handle references and binding redirects, as well as manage framework updates.

Upgrades are handled in a way that saves time and effort by minimizing manual tasks, while significantly reducing the margin of error.

What About NuGet?

In order to use Upgrade CLI you must have a NuGet-based Sitefinity installation. NuGet is the package manager for .NET. A solution enabling developers to create, share and consume code effortlessly and efficiently. Each NuGet package contains compiled code and content files in an archive with a .nupkg extension.

Sitefinity comes with its own set of NuGet packages containing reusable code to simplify and streamline various tasks in your projects—one particularly convenient application is getting and installing upgrades. That is to say, NuGets are still instrumental, but the procedure is just the right bit more straightforward and reliable when handled by the Sitefinity CLI.

Make sure you look at this great summary of the Sitefinity upgrade procedure that maps out the available upgrade methods based on your current Sitefinity CMS version. And by the way, this blog post is still very much relevant if you want to keep on upgrading manually using NuGet packages.

Back to the point, A Sitefinity upgrade is performed in two stages. The first one involves updating the binary files and all references across your projects. The second one is updating the config files and the dB schema when you start the project for the first time after stage 1.

The Sitefinity CLI fully handles the first step, updating the binary files and references across projects. However, the Command Line Interface (CLI) can be integrated into a CI (Continuous Integration) process, which will enable the second stage. That’s how Sitefinity Cloud handles it.

Step by Step: The Upgrade Procedure

So, what it is the Sitefinity CLI does? Let’s break down the steps, keeping in mind that the upgrade command deals with Sitefinity-related projects only. Projects in your solution that don’t reference any Sitefinity packages, will not be modified.

The upgrade CLI command has the following syntax and here’s what it actually does.

sf upgrade "{{path to the solution you want to upgrade}}" "{{version you are upgrading to}}"

  1. Restore NuGet packages
  2. Based on the current Sitefinity version you’re on, a list of packages is built that needs to be updated (for every Sitefinity project in your solution). A prompt with the new Sitefinity EULA (End User License Agreement) will appear, which you’ll need to accept to complete the upgrade (by typing ‘Y’ in the console).

    CLI Upgrade Config

  3. Change the target framework of the projects if needed
  4. Download Sitefinity packages specified in the input parameter
  5. Launch Visual Studio
  6. The package manager console opens in Visual Studio. After the VS instance is launched, a PowerShell script is run, based on the input parameter in step 1, that triggers the NuGet upgrade.

  7. Check and fix broken references in.csproj files
  8. After the NuGet packages are upgraded, Visual Studio closes, and the next step is checking and fixing broken references in the .csproj files.

  9. Fix binding redirects – if any

By the way, you can customize the sequence by adding the following optional parameters to the command:

--packageSources specifies a NuGet feed other than the default
--acceptLicense will automatically accept the EULA and skip the accept license step
--skipPrompts will disable the prompt to keep the project under source control


An important note to make here is that you need to rebuild your project once the CLI has finished with the upgrade process. Now, you can run the application, which will trigger an update of both the database and the config files.

CLI Upgrade-Console

That’s it then, all you need to do is run the Upgrade command, sit back and watch it do its magic. Respond to the prompts, if any, keep the project under source control and don’t close Visual Studio unless—for whatever reason—you need to cancel the upgrade. Here go the key benefits of upgrading via CLI:

  • The Sitefinity CLI automatically handles broken or missing references
  • The target framework is automatically set to the relevant Sitefinity framework version
  • The Sitefinity CLI automatically fixes binding redirects
  • All the projects in the solution are automatically upgraded without having to manually run through every single one
  • Can run in a Continuous Integration pipeline to trigger an update of the config files and DB schema after you rebuild and run the updated site or application
Sitefinity GitHub CLI

Now, before we wrap it up, you’re welcome to explore the duly updated documentation on the Sitefinity Upgrade Procedure. Make sure you get the latest version of the Sitefinity CLI too. With it, upgrades are that much easier. I hope we all agree the importance of staying up to date cannot be overstated. So, do the right thing and upgrade.

AntonTenev

Anton Tenev

A new addition to the Sitefinity Product Marketing team, Anton has a mixed background of software and writing for the web. He has spent the last 7 years in software development, on the project management and product ownership side, all the while writing about technology, gadgets and their use and usability. Always trying to get to the bottom of it without missing the bigger picture.

Comments
Comments are disabled in preview mode.
Topics
Latest Stories
in Your Inbox

Subscribe to get all the news, info and tutorials you need to build better business apps and sites

Sitefinity Training and Certification Now Available.

Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.

Learn More
More From Progress
CaseStudy-Resource_Image RITM0103215
Aprilaire Partners Mobile Use Soars 75% with Progress Sitefinity
Read Success Story
 
net_rocket_300x225
Supercharge Your Development with Sitefinity and .NET Core
Watch Webinar
 
SF-Performance-WP-thumb
Sitefinity CMS Performance
Download Whitepaper