Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions PowerShell/Module/Private/_DeploymentFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -324,28 +324,31 @@ function _configureAmazonLambdaTools
{
Write-Host 'Restoring .NET Lambda deployment tool'

Write-Verbose -Message 'Installing .NET Global Tool Amazon.Lambda.Tools'
# see if tool is already installed
$amazonLambdaToolsInstalled = & dotnet tool list -g | Select-String -Pattern Amazon.Lambda.Tools -SimpleMatch -Quiet

# When "-Verbose" switch was used this output was not hidden.
# Using stream redirection to force hide all output from the dotnet cli call
& dotnet tool install -g Amazon.Lambda.Tools *>&1 | Out-Null

if ($LASTEXITCODE -ne 0)
if (-not $amazonLambdaToolsInstalled)
{
Write-Verbose -Message 'Error installing, attempting to update Amazon.Lambda.Tools'
Write-Verbose -Message 'Installing .NET Global Tool Amazon.Lambda.Tools'
& dotnet tool install -g Amazon.Lambda.Tools *>&1 | Out-Null
}
else
{
Write-Verbose -Message 'Updating .NET Global Tool Amazon.Lambda.Tools'

# When "-Verbose" switch was used this output was not hidden.
# Using stream redirection to force hide all output from the dotnet cli call
& dotnet tool update -g Amazon.Lambda.Tools *>&1 | Out-Null
}

if ($LASTEXITCODE -ne 0)
{
$msg = @"
if ($LASTEXITCODE -ne 0) {
$msg = @"
Error configuring .NET CLI AWS Lambda deployment tools: $LastExitCode
CALLSTACK:$(Get-PSCallStack | Out-String)
"@
throw $msg
}
throw $msg
}

$toolsFolder = Join-Path -Path '~' -ChildPath '.dotnet' -AdditionalChildPath 'tools'
Expand Down