You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

M1芯片Mac安装多版本.NET(6/7)及运行时错误解决求助

M1芯片Mac上.NET 6与.NET 7共存问题及dotnet-ef运行报错

问题背景

在M1芯片的Mac上尝试同时安装.NET 6和.NET 7,多种安装方式后系统仍仅识别.NET 7,导致运行dotnet-ef时出现版本不匹配错误。

已尝试的安装操作及问题

1. Homebrew安装

  • 成功安装.NET 7,路径:/opt/homebrew/Cellar/dotnet/7.0.100
  • 成功安装.NET 6,路径:/opt/homebrew/Cellar/dotnet@6/6.0.114
  • 执行dotnet --list-runtimes仅返回.NET 7信息:
Microsoft.AspNetCore.App 7.0.0 [/opt/homebrew/Cellar/dotnet/7.0.100/libexec/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.0 [/opt/homebrew/Cellar/dotnet/7.0.100/libexec/shared/Microsoft.NETCore.App]

2. 官方安装脚本

  • 下载官网dotnet-install.sh脚本,指定安装.NET Runtime 6.0.20
  • 执行命令:
chmod +x dotnet-install.sh
sudo ./dotnet-install.sh --runtime dotnet --version 6.0.20 --install-dir /opt/homebrew/Cellar/dotnet 
sudo ./dotnet-install.sh --runtime aspnetcore --version 6.0.20 --install-dir /opt/homebrew/Cellar/dotnet
  • 问题:执行dotnet --list-runtimes仍仅显示7.0.0,且未生成6.0.20独立文件夹,文件直接安装在dotnet根目录下

3. 官方安装包

  • 安装.NET 6的SDK和Runtime安装包,安装完成后系统仍仅识别.NET 7

dotnet-ef运行错误信息(中文翻译版)

必须安装或更新.NET才能运行此应用程序。

应用程序路径: /Users/USERNAME/.dotnet/tools/.store/dotnet-ef/6.0.14/dotnet-ef/6.0.14/tools/net6.0/any/tools/netcoreapp2.0/any/ef.dll
架构: arm64
所需框架: 'Microsoft.NETCore.App', 版本 '6.0.0' (arm64)
当前.NET路径: /opt/homebrew/Cellar/dotnet/7.0.100/libexec/

已检测到的框架:
  7.0.0 位于 [/opt/homebrew/Cellar/dotnet/7.0.100/libexec/shared/Microsoft.NETCore.App]

了解框架解析机制:
https://aka.ms/dotnet/app-launch-failed

如需安装缺失框架,请访问下载链接:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=arm64&rid=osx.13-arm64

附加截图

系统环境变量配置
dotnet相关目录结构


内容的提问来源于stack exchange,提问作者GThree

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 02:05:34