File tree Expand file tree Collapse file tree 2 files changed +20
-41
lines changed Expand file tree Collapse file tree 2 files changed +20
-41
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- echo " Starting .NET uninstall on macOS..."
3+ # Download uninstall tool
4+ latest_release_json=$( curl -s https://api.github.com/repos/dotnet/cli-lab/releases/latest)
5+ download_url=$( echo " $latest_release_json " | grep " browser_download_url" | grep " osx-x64.tar.gz" | cut -d ' "' -f 4)
6+ filename=$( basename " $download_url " )
7+ curl -L -o " $filename " " $download_url "
48
5- # Define paths and URLs
6- UNINSTALL_TOOL_URL=" https://aka.ms/dotnet-core-uninstall-tool-macos"
7- UNINSTALL_TOOL_DIR=" /usr/local/share/dotnet-core-uninstall"
8- ZIP_PATH=" /tmp/dotnet-core-uninstall-tool.zip"
9- TOOL_EXEC=" $UNINSTALL_TOOL_DIR /dotnet-core-uninstall"
10-
11- # Download the uninstall tool
12- echo " Downloading .NET Uninstall Tool..."
13- curl -L " $UNINSTALL_TOOL_URL " -o " $ZIP_PATH "
14-
15- # Create destination directory
16- sudo mkdir -p " $UNINSTALL_TOOL_DIR "
17-
18- # Extract the tool
19- echo " Extracting..."
20- sudo unzip -o " $ZIP_PATH " -d " $UNINSTALL_TOOL_DIR "
21- rm " $ZIP_PATH "
22-
23- # Make it executable
24- sudo chmod +x " $TOOL_EXEC "
9+ # Prepare uninstall tool
10+ tar -xzf " $filename "
11+ tool_path=$( find . -name dotnet-core-uninstall)
12+ chmod +x " $tool_path "
2513
2614# Perform uninstall
27- echo " Removing all SDKs and runtimes..."
28- " $TOOL_EXEC " remove --all
29-
30- echo " .NET uninstall process completed."
15+ " $tool_path " remove --all
Original file line number Diff line number Diff line change 1- Write-Output " Starting .NET uninstall on Windows..."
1+ # Download uninstall tool
2+ $releases = Invoke-RestMethod - Uri " https://api.github.com/repos/dotnet/cli-lab/releases/latest"
3+ $asset = $releases.assets | Where-Object { $_.name -eq " dotnet-core-uninstall.msi" } | Select-Object - First 1
4+ $url = $asset.browser_download_url
5+ Invoke-WebRequest - Uri $url - OutFile $ (Split-Path $url - Leaf)
26
3- $uninstallToolPath = " C:\Program Files\dotnet-core-uninstall\dotnet-core-uninstall.exe"
4- $uninstallToolDownloadUrl = " https://aka.ms/dotnet-core-uninstall-tool-win"
5-
6- # Install uninstall tool
7- Write-Output " Downloading .NET Uninstall Tool..."
8- $zipPath = " $env: TEMP \dotnet-core-uninstall-tool.zip"
9- Invoke-WebRequest - Uri $uninstallToolDownloadUrl - OutFile $zipPath
10-
11- Write-Output " Extracting..."
12- Expand-Archive - Path $zipPath - DestinationPath " C:\Program Files\dotnet-core-uninstall" - Force
13- Remove-Item $zipPath
7+ # Prepare uninstall tool
8+ $pwd = (Get-Location ).Path
9+ msiexec.exe / A dotnet- core- uninstall.msi TARGETDIR= $pwd / QN / L* V log.txt
10+ $uninstallToolPath = Join-Path $pwd " dotnet-core-uninstall\dotnet-core-uninstall-tool.exe"
1411
1512# Perform uninstall
16- Write-Output " Removing all SDKs and runtimes..."
17- & " $uninstallToolPath " remove -- all
18-
19- Write-Output " .NET uninstall process completed."
13+ $uninstallToolPath remove -- all
You can’t perform that action at this time.
0 commit comments