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

.NET MAUI发布至App Store遇Invalid bundle structure错误求助

解决.NET MAUI iOS发布App Store错误90171(Invalid bundle structure)的方案

调整构建命令参数

  • 添加AOT编译参数:在发布命令中加入-p:EnableAOTCompilation=true,AOT编译会将依赖的原生库直接编译进主二进制,避免多余的.dylib文件被打包。修改后的完整命令示例:
    dotnet publish -f:net8.0-ios -c:Release -p:ServerAddress=MacIP -p:ServerUser=UserName -p:ServerPassword=UserPassWord -p:TcpPort=58181 -p:ArchiveOnBuild=true -p:_DotNetRootRemoteDirectory=/Users/UserName/Library/Caches/Xamarin/XMA/SDKs/dotnet/ -p:RuntimeIdentifier=ios-arm64 -p:EnableAssemblyILStripping=true -p:EnableAOTCompilation=true
    
  • 若IL Stripping导致异常,可临时移除-p:EnableAssemblyILStripping=true参数,验证是否解决问题。

清理构建缓存

  • 本地执行清理命令:dotnet clean
  • 登录Mac构建主机,删除/Users/UserName/Library/Caches/Xamarin/XMA/SDKs/dotnet/目录下的缓存文件,避免旧缓存导致的打包异常。

排查项目配置与依赖

  • 检查项目目录,确认没有手动添加的.dylib文件,若有则移除。
  • 打开项目的.csproj文件,排查是否存在自定义的<CopyToOutputDirectory>规则,避免将不必要的原生库复制到输出包中。

用Xcode验证并修复包结构(临时方案)

  • 找到构建生成的.xcarchive文件,右键选择“显示包内容”,进入Products/Applications/YourApp.app目录。
  • 删除目录下的libxamarin-dotnet.dylib、libSystem.Net.Security.Native.dylib等违规文件,然后重新用Xcode导出IPA包,再通过Transporter提交。

内容的提问来源于stack exchange,提问作者Taras Lisniak

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.22 14:55:58