在 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="'$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' != 'arm64'">iossimulator-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'arm64'">iossimulator-arm64</RuntimeIdentifier>