Azure DevOps流水线中Xcode构建失败(返回码65)求助
问题背景
使用Azure DevOps构建流水线CI构建Xcode工作区,本地及真机运行正常,但流水线构建时返回错误代码65,核心报错为无法加载Pod生成的xcfilelist文件:
##[error]Error: /usr/bin/xcodebuild failed with return code: 65
❌ error: Unable to load contents of file list: '/Target Support Files/Pods-ProjectName/Pods-ProjectName-frameworks-Release-input-files.xcfilelist' (in target 'ProjectName' from project 'ProjectName')
❌ error: Unable to load contents of file list: '/Target Support Files/Pods-ProjectName/Pods-ProjectName-frameworks-Release-output-files.xcfilelist' (in target 'ProjectName' from project 'ProjectName')
流水线YAML配置如下:
trigger: - A/B_testing pool: vmImage: 'macos-latest' steps: - task: Xcode@5 inputs: actions: 'build' configuration: 'Release' sdk: 'iphoneos' xcWorkspacePath: 'ProjectName.xcworkspace' scheme: 'ProjectName' xcodeVersion: '13' packageApp: false signingOption: 'default'
已尝试移除Build Phase输入输出文件、重新安装Pods、Podfile添加代码等方案,均未解决,本地使用Xcode 13.4构建正常。
可行解决方案
1. 显式添加Pod安装步骤
Azure DevOps的macos-latest镜像不会自动执行pod install,必须在Xcode构建前手动触发依赖安装,更新流水线YAML:
steps: - script: | pod install --repo-update displayName: 'Install CocoaPods dependencies' - task: Xcode@5 inputs: actions: 'build' configuration: 'Release' sdk: 'iphoneos' xcWorkspacePath: 'ProjectName.xcworkspace' scheme: 'ProjectName' xcodeVersion: '13' packageApp: false signingOption: 'default'
2. 修正xcfilelist路径引用
检查Xcode项目中Pod相关Build Phase的路径配置:
- 打开项目的
ProjectNametarget,进入Build Phases->[CP] Embed Pods Frameworks - 查看
Input Files和Output Files中的路径,确保以$(SRCROOT)/Target Support Files/开头(相对路径),而非绝对路径 - 若路径为绝对路径,手动修改为相对路径后重新提交代码
3. 清理流水线缓存
Azure DevOps可能缓存了旧的Pod构建产物,导致路径不匹配:
- 进入流水线的运行详情页面,点击右上角
More options->Clean - 清理完成后重新触发构建
4. 指定与本地一致的Xcode版本
流水线中xcodeVersion: '13'可能指向13.x系列的非13.4版本,尝试指定具体版本路径:
- task: Xcode@5 inputs: actions: 'build' configuration: 'Release' sdk: 'iphoneos' xcWorkspacePath: 'ProjectName.xcworkspace' scheme: 'ProjectName' xcodeVersion: 'specifyPath' xcodePath: '/Applications/Xcode_13.4.app' packageApp: false signingOption: 'default'
注:可通过在流水线中添加script: xcode-select -p命令确认镜像中Xcode 13.4的实际路径
5. 检查Podfile配置
- 若之前添加过
install! 'cocoapods', :disable_input_output_paths => true,尝试移除该配置后重新执行pod install并提交代码 - 确认Podfile中的
platform版本与项目的部署目标版本一致
内容的提问来源于stack exchange,提问作者Neeraj Joshi

