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

Mac版Visual Studio中Xamarin.iOS无法运行,报错MT0026

解决Visual Studio for Mac中Generic模拟器运行iOS应用时的MT0026错误

你遇到的错误信息如下:

error MT0026: Could not parse the command line argument '-sdk': Version string portion 
was too short or too long.
Parameter name: input

以下是几个可行的解决步骤:

  • 确认Xcode路径配置:打开Visual Studio for Mac的偏好设置(Visual Studio > Settings),进入Projects > SDK Locations > Apple > Xcode,确保路径指向最新安装的Xcode(默认路径为/Applications/Xcode.app),若路径有误,手动选择正确的Xcode应用程序。

  • 重置iOS模拟器状态:

    1. 关闭Visual Studio和所有运行中的iOS模拟器
    2. 打开终端,执行命令清除模拟器所有数据:xcrun simctl erase all
    3. 重启Visual Studio后重新尝试运行应用
  • 清理并重建项目:

    1. 在Visual Studio中选中目标项目,点击菜单栏的Project > Clean
    2. 清理完成后执行Build > Rebuild Solution
    3. 再次尝试在Generic模拟器上启动应用
  • 修正Xcode命令行工具路径:

    1. 打开终端,执行xcode-select -p查看当前命令行工具路径
    2. 若输出不是/Applications/Xcode.app/Contents/Developer,执行sudo xcode-select -s /Applications/Xcode.app/Contents/Developer切换到最新Xcode的命令行工具

内容的提问来源于stack exchange,提问作者Carlos.Net

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.22 23:28:08