dotnet
从.net6
版本开始支持 m1芯片的mac 也就是能下载 arm
的sdk
和runtime
,但是有苹果的转译中间层使得 .net core2.1
、.net core 3.1
和.net 5
也能使用。但是有个非常重要的一点,他们不能同时安装,也就是说,如果你要使用.net5
那就不能安装net6
,如果同时安装了.net5
和.net6
这会导致 .net5
的sdk失效。同理安装了 .net core2.1
就不能安装.net core3.1
.net6
及以上可以同时安装
.net core3.1
、.net 5
可以同时安装
.net core2.0
、net core2.1
可以同时安装
#!/usr/bin/env bash
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
current_user=$(whoami)
if [ $current_user != "root" ]; then
echo "$(basename "$0") uninstallation script requires superuser privileges to run"
exit 1
fi
# this is the common suffix for all the dotnet pkgs
dotnet_pkg_name_suffix="com.microsoft.dotnet"
dotnet_install_root="/usr/local/share/dotnet"
dotnet_path_file="/etc/paths.d/dotnet"
remove_dotnet_pkgs(){
installed_pkgs=($(pkgutil --pkgs | grep $dotnet_pkg_name_suffix))
for i in "${installed_pkgs[@]}"
do
echo "Removing dotnet component - \"$i\""
pkgutil --force --forget "$i"
done
}
remove_dotnet_pkgs
[ "$?" -ne 0 ] && echo "Failed to remove dotnet packages." && exit 1
echo "Deleting install root - $dotnet_install_root"
rm -r "$dotnet_install_root"
rm "$dotnet_path_file"
echo "dotnet packages removal succeeded."
exit 0