Created
March 5, 2022 13:03
-
-
Save tingwei628/af1cee66c16729f4bce387ec8d012f0b to your computer and use it in GitHub Desktop.
Manually delete unnecessary sdks and runtimes in .Net Core
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Step 1: target at versions you want to delete | |
# Step 2: chmod +x delete_dotnet_core.sh | |
# Step 3: ./delete_dotnet_core.sh | |
# Target sdks to remove | |
declare -a sdkVersions=("3.0.101" "3.1.401") | |
for sdkVersion in "${sdkVersions[@]}" | |
do | |
sudo rm -rf /usr/local/share/dotnet/sdk/$sdkVersion | |
# sudo rm -rf /usr/local/share/dotnet/sdk-manifests/$sdkVersion | |
done | |
# Target runtimes to remove | |
declare -a runtimeVersions=("2.1.14" "2.1.21" "3.0.1" "3.1.7") | |
for runtimeVersion in "${runtimeVersions[@]}" | |
do | |
sudo rm -rf /usr/local/share/dotnet/host/fxr/$runtimeVersion | |
sudo rm -rf /usr/local/share/dotnet/shared/Microsoft.AspNetCore.App/$runtimeVersion | |
sudo rm -rf /usr/local/share/dotnet/shared/Microsoft.NETCore.App/$runtimeVersion | |
done | |
# Target other packs to remove | |
declare -a otherPackRuntimeVersions=("3.0.0" "3.0.1" "3.1.3" "3.1.7" "3.1.8") | |
for runtimeVersion in "${otherPackRuntimeVersions[@]}" | |
do | |
sudo rm -rf /usr/local/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/$runtimeVersion | |
sudo rm -rf /usr/local/share/dotnet/packs/Microsoft.NETCore.App.Host.osx-x64/$runtimeVersion | |
sudo rm -rf /usr/local/share/dotnet/packs/Microsoft.NETCore.App.Ref/$runtimeVersion | |
sudo rm -rf /usr/local/share/dotnet/packs/NETStandard.Library.Ref/$runtimeVersion | |
sudo rm -rf /usr/local/share/dotnet/templates/$runtimeVersion | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment