自.net6
开始,微软提供了arm
版本的SDK。visual studio for mac安装 .net6、.net7
也是arm版本的。arm
和x64
版本安装的路径不同
arm
路径:/usr/local/share/dotnet
x64
路径:/usr/local/share/dotnet/x64
由于安装路径的不同会导致即使安装了dotnetcore3.1
和net6
的时候,在启动dotnetcore3.1
项目的时候也会提示找不到包。这时候就要切换启动程序dotnet
1. net6
Jetbrain Rider
MSBuild version路径:/usr/local/share/dotnet/sdk/7.0.202/MSBuild.dll
这里选arm
最高版本的SDK包
Visual Studio for Mac
工具 -> 首选项
2.dotnetcore3.1
JetBrain Rider
MSBuild version路径:/usr/local/share/dotnet/x64/sdk/3.1.426/MSBuild.dll
这里选x64
最高版本的SDK包
Visual Studio for Mac
工具 -> 首选项
注:
x64
能在m1上运行是苹果做了转译操作。猜测:这个过程需要时间。浏览器运行起来了,转译还没完成,就会出现这种情况。要么换个浏览器访问,要么清除浏览器缓存再访问,就可以了。
参考文档:https://learn.microsoft.com/zh-cn/dotnet/core/install/macos#download-and-manually-install