Mac运行MAUI默认程序报错

我在Mac系统运行MAUI的默认程序时出现如下报错:

Can not execute “path to project/project.dll”. The selected execution mode is not supported for .NET projects.

解决办法:安装微软官方的安装教程,完整安装运行MAUI所需的所有工作负载(一共有4个)。

微软官方安装MAUI教程:https://learn.microsoft.com/zh-cn/dotnet/maui/get-started/installation?tabs=vsmac

.Net 和 .Net MAUI
Android 和 IOS

总结:1、按照官方的安装教程,安装Visual Studio for mac以及对应的MAUI工作负载。

            2、安装Xcode。(打开Apple store 搜索安装)

            3、程序目录不要有中文!(我把程序目录存放在One drive文件夹,它其实是“One drive 个人”,后面运行时报错不知道什么问题,换个无中文路径的文件夹,就正常了。)

            4、国外也有人在社区提问过,一开始以为是MAUI的问题,然而进入程序目录的命令行,执行 dotnet build -t:Run -f net6.0-maccatalyst 是可以运行的,所以判定为是Visual Studio的问题。有人也是通过额外安装工作负载解决的,VS官方的说法是通过后续更新解决。

Visual Studio 社区:https://developercommunity.visualstudio.com/t/Error---selected-execution-mode-not-supp/10098896

GitHub 社区:https://github.com/dotnet/maui/issues/8894

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容