Pages

Showing posts with label Sitecore Upgrade. Show all posts
Showing posts with label Sitecore Upgrade. Show all posts

18 August, 2021

Sitecore Upgrade - Codebase Upgrade Series - Framework upgrade - .NET

As part of the Sitecore codebase upgrade series, in this blog, we are going to deal with upgrading .NET Framework version. 

Option 1: Using PowerShell, we can quickly update the version in all the csproj files. The script has been added in this blog. This script will update both legacy and SDK project format.

Option 2: To upgrade .NET framework, you can open the csproj files in Notepad++ and replace the version number from 4.x to 4.8 (or desired version as per Sitecore). 

  • SDK Style Projects
    Should replace <TargetFramework>net4xx</TargetFramework> with the targeted version. 
  • Legacy Style Projects
    Should replace <TargetFrameworkVersion>v4.x.x</TargetFrameworkVersion> with the targeted version. 

Option 3: There is a Visual Studio marketplace module called TargetFrameworkMigrator. Once you install it, you can change the target framework to the desired version. This will work only for the Legacy Style Projects. SDK Style Project support will be added in the next version as per the roadmap. 

  • Once you install the VS Extension. Open the extension from Tools menu --> Target Framework Migrator.
  • Choose the projects you want to migrate, then click Migrate. 


06 May, 2021

Sitecore Upgrade - Sitecore NuGet Package Upgrade using PowerShell

This blog is related to thSitecore codebase upgrade series.

Sitecore enabled package management system for the Sitecore packages from version 9.x. This has helped to avoid unnecessary and complicated reference management. In order to do .NET framework upgrade and Sitecore NuGet package upgrade, there are various ways as follows.
  1. Using NuGet Package Manager 
  2. Using PowerShell Package Manager Console
  3. NuGet CLI
  4. dotnet CLI
Certain Sitecore Helix solution may have 100s of projects so using NuGet Package Manager in Visual Studio may not be productive. As a programmer, you can leverage the PowerShell Package Manager Console to inspect each project and update the packages. 

Gary has written a script to update the Sitecore Packages and as he mentioned, it is easy to extend and tweak it as per our need. One of my requirement is to find the projects which are having Sitecore Packages and update all the packages to the target version in a single shot.  

The below script accepts the old package version and the new package version and finds all the projects having "Sitecore." packages and upgrades the packages to the target version along with dependencies. Save the gist file as nuget_Profile.ps1 in C:\Users\[user]\Documents\WindowsPowerShell folder and restart the Visual Studio for the PowerShell Package Manager console to pick up the profile scripts. 
  1. Finds all the projects with Sitecore packages
  2. Loop through each projects and updates the Sitecore Packages.
  3. If NoReference Package is installed, it finds the alternative package with NoReference and installs it. 
In the PowerShell Package Manager console, execute the method along with old and new package version as below. Please note script is defaulted to version 9.3.0 as old version and version 10.1.0 as the new version. 
UpdateSitecorePackagesForAllProjects -NewVersion 9.0.171219 -OldVersion 10.0.1



01 May, 2021

Sitecore Upgrade - Codebase Upgrade Series

One of the task in a Sitecore upgrade project is to upgrade the codebase to be compatible with the target Sitecore version. I have listed some of the steps which I learnt and it helped me to upgrade the solution quickly. 

  1. Remove unused references and nuget packages
  2. Framework upgrade - .NET
  3. Migrate to SDK Project Format (optional)
  4. Migrate from packages.config to PackageReference
  5. Replace Sitecore assemblies reference with nuget package
  6. Upgrade Sitecore nuget packages
  7. Upgrade .NET related nuget packages
  8. Upgrade 3rd party nuget packages
  9. Compile, replace obsolete methods and fix errors
Before upgrading the codebase, make sure to create a separate branch so that it does not affect the ongoing development tasks. 

Visual Studio PowerShell related articles to run scripts. 


Sitecore Upgrade related articles.





blockquote { margin: 0; } blockquote p { padding: 15px; background: #eee; border-radius: 5px; } blockquote p::before { content: '\201C'; } blockquote p::after { content: '\201D'; }