Skip to content

Instantly share code, notes, and snippets.

@bic742
Created January 25, 2023 15:01
Show Gist options
  • Save bic742/7e6568a44eb98f5deff2e8b98af4b54b to your computer and use it in GitHub Desktop.
Save bic742/7e6568a44eb98f5deff2e8b98af4b54b to your computer and use it in GitHub Desktop.
This script can be used to update all Nuget references in a Helix solution. This is useful for cases where there are many projects and manually updating the references would take a lot of time. This script has to be executed via the Package Manager Console in Visual Studio.
$projects = Get-ChildItem -Path "C:\{solution_dir}\src" -Filter *csproj -Recurse | ForEach-Object { $project = $_; $packages = Select-Xml -Path "$($project.Directory.FullName)/packages.config" -XPath '/packages/package' | ForEach-Object { if ($_.Node.id -like "Sitecore*" -and $_.Node.version -eq "9.1.1") { Install-Package $_.Node.id -Project $project.BaseName -Version "10.2.0" -IgnoreDependencies } } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment