简体   繁体   中英

Powershell Get Latest from Nuget Feed

I am needing to create a powershell script that will pull down the latest packages from our nuget feed. This script will run during a TeamCity build to help with a caching issue that we are having with the nuget packages. I have not worked with powershell before, so any help would be greatly appreciated. This is what I have so far:

 $packagesConfigFiles = Get-ChildItem $path -Recurse | Where-Object {$_.Name -eq "packages.config"} foreach($packagesConfig in $packagesConfigFiles){ .\\nuget.exe i $packagesConfig.FullName -o Source\\Packages } 

Just in case someone needs it I wanted to post what I used for my solution.

Set-ExecutionPolicy Unrestricted 

$packagesConfigFiles = Get-ChildItem $path -Recurse | Where-Object {$_.Name -eq "packages.config"}

if (Test-Path packages){

    Write-Host "Delete packages folder."
    Remove-Item packages -recurse
}

foreach($packagesConfig in $packagesConfigFiles){      

    .nuget\NuGet.exe i $packagesConfig.FullName -o packages
}

Write-Host "Press any key to continue..."
    $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp") > $null

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM