关于m1芯片的mac同时安装 dotnet的问题

dotnet.net6版本开始支持 m1芯片的mac 也就是能下载 armsdkruntime,但是有苹果的转译中间层使得 .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.0net 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

卸载所有dotnet参考

安装.net5 参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值