-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathupdate.ps1
23 lines (21 loc) · 900 Bytes
/
update.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/local/bin/powershell
# For this script to work with our Azure DevOps feeds,
# you need to install the credential provider for Azure DevOps:
# https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.ps1
$regex = 'PackageReference Include="([^"]*)" Version="([^"]*)"'
ForEach ($file in get-childitem . -recurse | where {$_.extension -like "*proj"})
{
$packages = Get-Content $file.FullName |
select-string -pattern $regex -AllMatches |
ForEach-Object {$_.Matches} |
ForEach-Object {$_.Groups[1].Value.ToString()}|
sort -Unique
ForEach ($package in $packages)
{
write-host "Update $file package :$package" -foreground 'magenta'
$fullName = $file.FullName
$command = "dotnet add $fullName package --interactive $package"
write-host $command
iex $command
}
}