Last active
August 8, 2018 14:51
-
-
Save nbarnwell/8302933 to your computer and use it in GitHub Desktop.
Update specific packages based on wildcard (or regex pattern) using PowerShell outside the Visual Studio Package Manager Console. Caveat: I'm not a PowerShell expert and I'm pretty sure there must be terser ways to accomplish the same, but the command-line argument requirements of nuget.exe required this to be more complex than I'd have liked. :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gci -r -inc packages.config | | |
%{ | |
([xml](get-content $_)).packages.package.id | | |
Add-Member -NotePropertyName 'PackageConfigFile' -NotePropertyValue $_ -PassThru | |
} | | |
?{ $_ -like 'MyCompany.*' } | | |
%{ nuget.exe update $_.PackageConfigFile -Id $_ -RepositoryPath (join-path (split-path (Split-Path $_.PackageConfigFile)) 'packages') } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you have the possibility, you could try Paket instead. It comes with this any many other great features not seen in nuget.exe