MacOS下安装.NET Maui遇卡顿问题求助
手动安装对应组件
先提取卡住行的组件名称,到微软官方组件库找到该组件的离线安装包,手动完成安装。之后重新执行Maui工作负载安装命令:dotnet workload install maui切换国内镜像源加速下载
临时替换NuGet源为国内加速节点,执行以下命令:dotnet nuget remove source nuget.orgdotnet nuget add source https://nuget.cdn.azure.cn/v3/index.json --name china-cdn
完成安装后可执行dotnet nuget add source https://api.nuget.org/v3/index.json --name nuget.org切回原源。清理工作负载缓存
清理可能损坏的缓存文件,避免安装异常:dotnet workload clean
清理后重新运行安装命令。使用离线缓存安装
先下载Maui工作负载的离线包(替换为你的.NET版本,例如7.0):dotnet workload download maui --source https://api.nuget.org/v3/index.json
下载完成后通过本地缓存安装:dotnet workload install maui --from-local-cache检查系统依赖完整性
确认系统已安装Maui所需的全部依赖:Windows需确保安装对应版本的Windows SDK、Visual Studio相关组件;macOS需安装Xcode及Command Line Tools,缺失依赖可能导致安装停滞。
内容的提问来源于stack exchange,提问作者EliasH

