Skip to content

Instantly share code, notes, and snippets.

@RobotOptimist
Created March 8, 2021 20:57
Show Gist options
  • Save RobotOptimist/b3d5127c638fc9e8a48bba139c42c72e to your computer and use it in GitHub Desktop.
Save RobotOptimist/b3d5127c638fc9e8a48bba139c42c72e to your computer and use it in GitHub Desktop.
PowerShell get nuget versions and update package.config
$nugetValues = Find-Package -Source "The Feed" | Select-Object Name, Version
$filePath = "muh\path\mmkay\packages.config"
[xml]$file = Get-Content -Path $filePath
foreach ($package in $file.packages.package) {
$nugetVersion = ($nugetValues | Where-Object Name -eq $package.id | Select-Object Version).Version
$nugetVersion
if ($null -ne $nugetVersion -and $nugetVersion -ne '') {
$package.version = $nugetVersion
}
}
$file.Save($filePath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment