diff --git a/appveyor.yml b/appveyor.yml index 1c33d0fe1..fc20c4fe9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -26,7 +26,23 @@ init: build_script: - ps: >- if ($isLinux) { - dotnet restore Discord.Net.sln -v Minimal /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" + # AppVeyor Linux images do not have appveyor-retry, which retries the commands a few times + # until the command exits with code 0. + # So, this is done with a short script. + $code = 0 + $counter = 0 + do { + dotnet restore Discord.Net.sln -v Minimal /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" + $code = $LASTEXITCODE + $counter++ + + if ($code -ne 0) + { + # Wait 5s before attempting to run again + Start-sleep -Seconds 5 + } + + } until ($counter -eq 5 -or $code -eq 0) } else { appveyor-retry dotnet restore Discord.Net.sln -v Minimal /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG" }