Skip to content

Commit 4b4e8fe

Browse files
committed
2 parents b9ccb35 + aa61791 commit 4b4e8fe

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [OpenByteDev]

.github/scripts/uninstall-dotnet-windows.ps1

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,25 @@ $headers = @{
44
}
55
$releases = Invoke-RestMethod -Uri "https://api.github.com/repos/dotnet/cli-lab/releases/latest" -Headers $headers
66
$asset = $releases.assets | Where-Object { $_.name -eq "dotnet-core-uninstall.msi" } | Select-Object -First 1
7+
8+
# Check if the asset is missing
9+
if (-not $asset) {
10+
throw "Release asset 'dotnet-core-uninstall.msi' was not found in the latest release."
11+
}
12+
if (-not $asset.browser_download_url) {
13+
throw "Release asset 'dotnet-core-uninstall.msi' does not have a browser_download_url."
14+
}
15+
716
$url = $asset.browser_download_url
817
Invoke-WebRequest -Uri $url -OutFile $(Split-Path $url -Leaf)
918

1019
# Prepare uninstall tool
11-
$extractPath = Join-Path $pwd "dotnet-core-uninstall" # needs to be a new path
20+
$extractPath = Join-Path $pwd "dotnet-core-uninstall"
21+
22+
# Run msiexec
1223
msiexec.exe /A dotnet-core-uninstall.msi TARGETDIR=$extractPath /QN /L*V log.txt
13-
$uninstallToolPath = Join-Path $extractPath "dotnet-core-uninstall" "dotnet-core-uninstall.exe"
24+
$uninstallToolPath = Join-Path $extractPath "PFiles" "dotnet-core-uninstall" "dotnet-core-uninstall.exe"
25+
1426
# wait for the tool to be ready
1527
$maxRetries = 30
1628
$retry = 0
@@ -19,8 +31,8 @@ while (-not (Test-Path $uninstallToolPath) -and ($retry -lt $maxRetries)) {
1931
$retry++
2032
}
2133
if ($retry -eq $maxRetries) {
22-
Write-Error "Uninstall tool was not found after $maxRetries seconds."
23-
Get-Content -Path "log.txt" | Write-Host
34+
Write-Host "Uninstall tool was not found after $maxRetries seconds."
35+
if (Test-Path "log.txt") { Get-Content -Path "log.txt" | Write-Host }
2436
exit 1
2537
}
2638

.github/workflows/rerun.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
rerun_if_uninstall_dotnet_failed:
1414
if: >
1515
github.event.workflow_run.conclusion == 'failure' &&
16-
github.event.workflow_run.run_attempt < 5
16+
github.event.workflow_run.run_attempt < 3
1717
runs-on: ubuntu-latest
1818

1919
steps:

0 commit comments

Comments
 (0)