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

.NET 8 MAUI iOS模拟器构建失败求助:VS for Mac相关问题

MAUI iOS 构建问题求助

背景

之前使用Xamarin Forms,因该框架即将停用,迁移至.NET 8 MAUI。借助辅助工具完成代码更新后,Android模拟器可正常构建项目,但iOS模拟器无法构建。当前使用VS for Mac v17版本,无法安装最新版,启动软件时会收到提示,该软件将于2024年8月停用。

问题表现

  • 选择目标设备时看不到任何iOS设备选项,仅显示net-8.0-ios、net-8.0-android、net-8.0-maccatalyst
  • 顶部提示未安装SDK

当前配置

  • .NET版本:8.0.301
  • .NET SDK:8.0.301、7.x、6.x、5.x、3.x

疑问

  1. 是否可通过VS在iOS设备模拟器中构建项目?若可以,为何我的项目无法构建?
  2. 是否有人成功使用VS或VS Code构建?

已尝试操作

  • 用VS Code构建,但.NET扩展存在Bug(非本次讨论主题)
  • 新建MAUI项目测试,仍出现相同问题

项目配置代码

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
        <!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
        <!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->

        <!-- Note for MacCatalyst:
        The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
        When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
        The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
        either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
        <!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->

        <OutputType>Exe</OutputType>
        <RootNamespace>MauiApp1</RootNamespace>
        <UseMaui>true</UseMaui>
        <SingleProject>true</SingleProject>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>

        <!-- Display name -->
        <ApplicationTitle>MauiApp1</ApplicationTitle>
...
</Project>

解答

  1. 能否用VS在iOS模拟器构建?
    可以,但你的情况大概率是VS for Mac v17版本对.NET 8 MAUI的iOS支持存在缺失,或是iOS SDK未正确安装/关联。VS for Mac v17在.NET 8推出后,后续更新才完善了MAUI的iOS适配,而你无法升级到最新版,就会出现SDK识别异常的问题。另外,iOS模拟器依赖Xcode,需要确认你的Xcode版本是否兼容.NET 8,且VS已正确关联Xcode路径。

  2. 有没有人成功用VS或VS Code构建?
    不少开发者成功用最新版VS for Mac或VS Code配合MAUI插件完成iOS项目构建,但VS Code的MAUI工具链目前确实存在部分稳定性问题。你当前因VS版本受限,建议优先排查Xcode与VS的关联状态,或是尝试手动指定iOS SDK路径。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.22 22:35:14