Restore Nuget Packages Using Powershell

watch #script to restore the pacakge
[cmdletBinding()]
param
(
[parameter(Mandatory = $true)]
$Solutions, #relative to bamboo working directory
[parameter(Mandatory = $true)]
$BuildWorkingDirectory,
[parameter(Mandatory = $true)]
$NugetPackage
)
$SlnList = $Solutions -split “;”
$NugetPackage = Join-Path $BuildWorkingDirectory $NugetPackage
foreach($Sln in $SlnList)
{
$sln = Join-Path $BuildWorkingDirectory $sln
Write-Host “$sln”
Write-Host “$NugetPackage”
if(Test-Path $Sln)
{
try
{
Write-Host “$NugetPackage restore $Sln”
& $NugetPackage restore $Sln
}
catch [Exception]
{
$_.Exception.GetType().FullName, $_.Exception.Message

http://directadvantagellc.com/?swift-slider=slider03 Write-Error ‘error restoring packages’
}
}
else
{
Write-Error ‘Solution File Doesnot exist’
}
}

Leave a Reply

follow link Your email address will not be published. Required fields are marked *