Maui Blazor 中文社区 QQ群:645660665

mac arm 调试 maui 提示 iOS 构建没有“net8.0-ios/iossimulator-x64”的目标

在 arm 芯片 mac 调试, 使用 mac for vs ,出现以下错误

obj/project.assets.json”没有“net8.0-ios/iossimulator-x64”的目标。确保已运行还原,且“net8.0-ios”已包含在项目的 TargetFrameworks 中。可能需要在项目 RuntimeIdentifiers 中包括“iossimulator-x64”。 (NETSDK1047) (xxx.Maui)

obj/project.assets.json’ doesn’t have a target for ‘net7.0-ios/ios-arm64’. Ensure that restore has run and that you have included ‘net7.0-ios’ in the TargetFrameworks for your project. You may also need to include ‘ios-arm64’ in your project’s RuntimeIdentifiers. (NETSDK1047) (xxx.PDSX)

原因

iOS 构建需要显式定义的 RuntimeIdentifier 值“iossimulator-x64”、“iossimulator-arm64”或“ios-arm64”

编辑项目文件添加以下这行

<RuntimeIdentifier Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' and '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'arm64'">iossimulator-arm64</RuntimeIdentifier>

Enjoy!

posted @ 2024-02-15 19:21  AlexChow  阅读(2268)  评论(0编辑  收藏  举报