[Windows] Add retry to Install-VsixExtension (#6934)

This commit is contained in:
Alexey-Ayupov
2023-01-18 17:51:36 +01:00
committed by GitHub
parent 7d596c7216
commit ea70a64733
@@ -274,7 +274,7 @@ function Install-VsixExtension
[string] $FilePath,
[Parameter(Mandatory = $true)]
[string] $VSversion,
[int] $retries = 20,
[int] $Retries = 20,
[switch] $InstallOnly
)
@@ -285,6 +285,8 @@ function Install-VsixExtension
$argumentList = ('/quiet', "`"$FilePath`"")
do
{
Write-Host "Starting Install $Name..."
$vsEdition = (Get-ToolsetContent).visualStudio.edition
try
@@ -322,8 +324,15 @@ function Install-VsixExtension
else
{
Write-Host "Unsuccessful exit code returned by the installation process: $exitCode."
exit 1
$Retries--
if ($Retries -eq 0) {
Write-Host "The $Name couldn't be installed after 20 attempts."
}else {
Write-Host "Waiting 10 seconds before retrying. Retries left: $Retries"
Start-Sleep -Seconds 10
}
}
} until ($exitCode -eq 0 -or $exitCode -eq 1001 -or $Retries -eq 0 )
#Cleanup downloaded installation files
if (-not $InstallOnly)