Last active
August 17, 2020 14:48
-
-
Save aqeelat/ec90fc1285107b7af735ea468932a97c to your computer and use it in GitHub Desktop.
Update a NuGet Package Across Multiple Projects in .NET Core
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
# uncomment lines 4, 5, and 10, and comment out line 11 | |
# if you want to take in the source directory as a parameter | |
param( | |
# [Parameter(Mandatory=$true)] | |
# [string]$sourceDirectory, | |
[Parameter(Mandatory=$true)] | |
[string]$packageId | |
) | |
# Set-Location $sourceDirectory | |
Set-Location C:\Source\ # change this to the your source directory | |
Get-ChildItem *.csproj -Recurse ` | |
| Where-Object {$_ | Select-String -Pattern ('"' + $packageId + '"')} ` | |
| ForEach-Object{ | |
$loc = Get-Location | |
# change this to the location of TF.exe in your environment | |
C:\'Program Files (x86)'\'Microsoft Visual Studio'\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\'Team Explorer'\TF.exe checkout $_.FullName | |
Set-Location(Split-Path($_.FullName)) | |
dotnet.exe add package $packageId | |
Set-Location($loc) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment