-
Automatic Sitecore NuGet upgrades with Powershell
November 2, 2021 Rodrigo Peplau 1
One of the most tedious tasks in any Sitecore upgrade is to update your NuGet references. If your projects have so many NuGet references on packages.config, and in special with Helix solutions, updating everything manually can take you several hours.
To the rescue, I’ve created this Powershell Script, which you can use to save your precious time.
What you need to download:
- The Powershell Script itself
- The CSV file with all Sitecore references from this article – Direct link to the CSV file itself is here.
This file is valid for Sitecore 10.1 – if you need a different version, you will have to prepare and use a different CSV file (Read the article to learn more)
Steps to update each project in your solution:
- Step 1 – If your upgrade requires, update your Project to the target .NET Framework
- Step 2 – Get the NuGet commands to update your project.
- Step 3 – Run the NuGet commands at the Package Manager Console of Visual Studio
It is recommended to update the references gradually, so you can detect and fix any issue as you continue.
In my experience, the following sequence produced good results:
- If your .NET Framework has changed due to the upgrade, re-install all references not used by Sitecore by running the following command:
.\Update-PackagesFile.ps1 -Csv “C:\temp\NuGet Sitecore.Platform.Assemblies 10.1.0 rev. 005207.csv” -Packages “D:\Git\myproject\packages.config” -ProjectName “MyProject” -DumpUnknownReinstall $true
- Update the 3rd party references to the target versions, and using this command:
.\Update-PackagesFile.ps1 -Csv “C:\temp\NuGet Sitecore.Platform.Assemblies 10.1.0 rev. 005207.csv” -Packages “D:\Git\myproject\packages.config” -ProjectName “MyProject” -DumpKnownReinstall $true
- Sometimes 3rd party reference versions didn’t change, but you still want to force them to reinstall. If that’s your case, use the command:
.\Update-PackagesFile.ps1 -Csv “C:\temp\NuGet Sitecore.Platform.Assemblies 10.1.0 rev. 005207.csv” -Packages “D:\Git\myproject\packages.config” -ProjectName “MyProject” -DumpKnownReinstall $true
- Finally, uninstall and re-install your Sitecore references (useful when migrating from earlier versions into SC10):
.\Update-PackagesFile.ps1 -Csv “C:\temp\NuGet Sitecore.Platform.Assemblies 10.1.0 rev. 005207.csv” -Packages “D:\Git\myproject\packages.config” -ProjectName “MyProject” -TargetSitecore “10.1” -DumpSitecoreUpdates $true
or simply update them with this command:
.\Update-PackagesFile.ps1 -Csv “C:\temp\NuGet Sitecore.Platform.Assemblies 10.1.0 rev. 005207.csv” -Packages “D:\Git\myproject\packages.config” -ProjectName “MyProject” -TargetSitecore “10.1” -DumpSitecoreUpdates $true -KeepSitecoreLibs $true
Full description of parameters:
- Csv (mandatory) – Path to the CSV file
- Packages (mandatory) – Path to the packages.config file
- ProjectName (mandatory) – Project Name
- TargetSitecore – Target Sitecore version
- DumpUnknownReinstall – If $true => Will dump the Update-Package with -reinstall commands for libraries not used by Sitecore
- DumpKnownUpdates – If $true => Will dump the Update-Package commands for known libraries when versions doesn’t match
- DumpKnownReinstall – If $true => Will dump the Update-Package with -reinstall when versions are the same
- DumpSitecoreUpdates – If $true => Will dump the Update-Package for Sitecore.* libraries
- KeepSitecoreLibs
- If $true => then the Sitecore entries will NOT be uninstalled (Update)
- If $false => then the Sitecore entries will be uninstalled and re-installed (useful when migrating from earlier versions into SC10)
Categories: Powershell, Upgrades
Sitecore 10.1 Form Send E-mail VS Community Send E-mail Sitecore Personalize: Difference between "Experiences" and "Experiments"
One thought on “Automatic Sitecore NuGet upgrades with Powershell”
Leave a Reply Cancel reply
Localization
Recent Posts
Recent Comments
- NAVAN on Automatic Sitecore NuGet upgrades with Powershell
- Hedipo S Menezes on Corey Peplau wrote this - WFFM conflict with Unity DI and a lesson on how Sitecore community is so amazing
- Rodrigo Peplau on ERROR [Content Testing]: Cannot find PhantomJS executable at ' (...) /data/tools/phantomjs/phantomjs.exe'. Aborting screenshot generation.
- Fred on ERROR [Content Testing]: Cannot find PhantomJS executable at ' (...) /data/tools/phantomjs/phantomjs.exe'. Aborting screenshot generation.
- Rodrigo Peplau on Language specific MediaProvider breaking icons at Media Library
Archives
- November 2023
- August 2023
- July 2023
- January 2023
- February 2022
- December 2021
- November 2021
- March 2021
- July 2020
- February 2020
- September 2019
- July 2019
- April 2019
- March 2019
- December 2018
- February 2018
- January 2018
- November 2017
- September 2017
- August 2017
- July 2017
- March 2017
- February 2017
- November 2016
- September 2016
- August 2016
- July 2016
- April 2016
- November 2015
- September 2015
- July 2015
- April 2015
- March 2015
- February 2015
Categories
- Actions
- Active Directory
- Analytics
- Architecture
- Bug fixing
- CDP/Personalize
- ChatGPT
- Content Edition Experience
- Content Hub
- Continuous Integration
- Dev
- Development
- Environments
- Experience Editor
- Experience Forms
- Front-end
- Health Check builds
- Helix
- How To
- LDAP
- MVP
- MVP Summit
- Phantom JS
- Powershell
- QA
- Richtext Editor
- Rules
- Security Provider
- SIF
- Sitecore 9
- Sitecore API
- Sitecore Community
- SItecore Connect
- Sitecore Modules
- Sitecore Rocks
- Sitecore Rule Processor
- Sitecore Symposium
- SPE
- SPEAK
- SUG
- Support Ticket
- TDS
- Team City
- Uncategorized
- Upgrades
- Visual Studio
- WFFM
- Workflow
- XConnect
- xDB
- XM Cloud
Think such tools are always useful. They are not only helpful to others but opens up further faculties to perform more… like stepping stones…. thanks for this one, will keep it in my pocket!