CI: fix macOS build on macos-26 (canonical Xcode 26.0.1 path + runFirstLaunch, ApplicationId for Mac sample)#4
Conversation
… workload Agent-Logs-Url: https://github.com/IoTSharp/NativeWebHost/sessions/4ad82dfa-d73e-4e0e-907c-d7b8cda30d94 Co-authored-by: maikebing <3445167+maikebing@users.noreply.github.com>
Agent-Logs-Url: https://github.com/IoTSharp/NativeWebHost/sessions/8a239f09-29a2-444c-84e6-001a2c16326c Co-authored-by: maikebing <3445167+maikebing@users.noreply.github.com>
|
@copilot 还是报错。 |
…acOS Exe builds Agent-Logs-Url: https://github.com/IoTSharp/NativeWebHost/sessions/ef54cef2-6752-46e3-9d28-679926a2673a Co-authored-by: maikebing <3445167+maikebing@users.noreply.github.com>
这次的错误已经不是 Xcode 的问题了,Xcode 26.0 已经选到,
<ApplicationId>com.iotsharp.nativewebhost.sample.mac</ApplicationId>
<ApplicationTitle>NativeWebHost.Sample.Mac</ApplicationTitle> |
|
@copilot 我看了, 但是还在报错。 |
…fix missing MacOSX SDK Agent-Logs-Url: https://github.com/IoTSharp/NativeWebHost/sessions/735b758e-d5bc-4c54-821c-f579eec319f9 Co-authored-by: maikebing <3445167+maikebing@users.noreply.github.com>
这次的报错变成了 SDK / 工具找不到(已不是 bundle id 也不是 Xcode 版本): 两个原因:
8692648 修改了
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates macOS sample metadata and adjusts GitHub Actions macOS jobs to use a newer runner image and explicitly select a specific Xcode version for building/packaging.
Changes:
- Add macOS app identifier/title metadata to the sample
.csproj. - Switch macOS CI/release jobs from
macos-latesttomacos-26. - Add steps to force-select a pinned Xcode app and run first-launch initialization before installing the macOS workload.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
samples/NativeWebHost.Sample.Mac/NativeWebHost.Sample.Mac.csproj |
Adds application identity/title properties for the macOS sample. |
.github/workflows/release.yml |
Moves macOS release jobs to macos-26 and pins Xcode selection before workload install. |
.github/workflows/ci.yml |
Moves macOS CI job to macos-26 and pins Xcode selection before workload install. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Select Xcode 26.0 | ||
| # The .NET 10 macOS workload (Microsoft.macOS.Sdk.net10.0_26.0 26.0.11017) | ||
| # pins Xcode to 26.0 exactly. The macos-26 image defaults to a newer Xcode | ||
| # (e.g. 26.2), which causes "requires Xcode 26.0" build errors. Switch to | ||
| # the Xcode 26.0.x installed on the image. Use the canonical 26.0.1 path | ||
| # rather than the /Applications/Xcode_26.0.app symlink — xcrun/xcodebuild | ||
| # otherwise fail to resolve the MacOSX SDK ("SDK ... cannot be located", |
| - name: Select Xcode 26.0 | ||
| # The .NET 10 macOS workload pins Xcode to 26.0 exactly; the macos-26 | ||
| # image defaults to a newer Xcode that the Xamarin SDK rejects. Use the | ||
| # canonical Xcode_26.0.1.app path (not the /Applications/Xcode_26.0.app | ||
| # symlink), and run -runFirstLaunch so the MacOSX SDK / command-line | ||
| # components are properly registered for the new selection. | ||
| shell: bash | ||
| run: | | ||
| sudo xcode-select -s /Applications/Xcode_26.0.1.app | ||
| sudo xcodebuild -runFirstLaunch | ||
| xcodebuild -version | ||
| xcrun --sdk macosx --show-sdk-path |
macOS CI 编译失败修复
第一轮
CI 中
Build macOS sample失败:原因:
macos-latest仍是 macOS 15 (Xcode 16.4),而 .NET 10 macOS workload 需要 Xcode 26。第二轮
切到
macos-26后仍失败:原因:
macos-26镜像默认 Xcode 已升级到 26.2,但 macOS workloadMicrosoft.macOS.Sdk.net10.0_26.0严格要求 Xcode 26.0。镜像同时预装了 Xcode 26.0.x,所以只需显式xcode-select切换即可。第三轮
Xcode 校验通过后,
Build macOS sample又出现新错误:原因:
net10.0-macos的Exe项目生成.appbundle 时必须有 bundle id,NativeWebHost.Sample.Mac既没有Info.plist也没有声明ApplicationId。第四轮
通过
/Applications/Xcode_26.0.app符号链接选择 Xcode 后,sample 构建出现:原因:
/Applications/Xcode_26.0.app只是指向Xcode_26.0.1.app的符号链接,xcrun/xcodebuild通过该符号链接路径解析 MacOSX SDK 时失败。必须使用规范的真实路径Xcode_26.0.1.app。sudo xcodebuild -runFirstLaunch才能注册命令行组件(install_name_tool等),否则它们不在 PATH 中。变更
.github/workflows/ci.yml:build-macos作业runs-on改为macos-26.github/workflows/release.yml:pack-nuget-macos、publish-samples-macos作业runs-on改为macos-26Install macOS workload步骤之前新增Select Xcode 26.0步骤:sudo xcode-select -s /Applications/Xcode_26.0.1.app(使用真实路径,避免Xcode_26.0.app符号链接导致 SDK 解析失败)sudo xcodebuild -runFirstLaunch(注册 SDK / 命令行工具)xcodebuild -version与xcrun --sdk macosx --show-sdk-path便于排查samples/NativeWebHost.Sample.Mac/NativeWebHost.Sample.Mac.csproj:新增<ApplicationId>com.iotsharp.nativewebhost.sample.mac</ApplicationId><ApplicationTitle>NativeWebHost.Sample.Mac</ApplicationTitle>