[msbuild] Fix Content/BundleResource with PublishFolderType not bundled in multi-RID builds. Fixes #25053.#25065
Conversation
…ed in multi-RID builds. Fixes #25053. In multi-RID (universal) builds, the outer build saves all Content and BundleResource items to processed-items files, and inner builds remove them. However, items with PublishFolderType are not actually processed by CollectBundleResources (it skips them) — they're handled via ResolvedFileToPublish instead. By incorrectly saving them as processed, the inner builds remove them before they can be added to ResolvedFileToPublish, so they never end up in the app bundle. Fix by filtering out items with PublishFolderType when writing the processed-items files. Fixes #25053. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes a multi-RID (universal) build bug in the MSBuild resource pipeline where Content/BundleResource items with PublishFolderType were incorrectly treated as “already processed”, causing inner RID builds to remove them before they could be added to ResolvedFileToPublish (and thus they never reached the app bundle).
Changes:
- Exclude
Content/BundleResourceitems withPublishFolderTypefrom the outer-build “processed items” lists written for multi-RID builds. - Extend the BundleStructure test project with
PublishFolderType=Resourcetest inputs for bothContentandBundleResource. - Update bundle-contents expectations to validate the new resources are present.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| msbuild/Xamarin.Shared/Xamarin.Shared.targets | Filters out PublishFolderType items when persisting processed-items lists, preventing inner builds from removing publish-handled assets. |
| tests/dotnet/BundleStructure/shared.csproj | Adds ContentJ/BundleResourceJ items using PublishFolderType=Resource to cover the scenario from #25053. |
| tests/dotnet/UnitTests/BundleStructureTest.cs | Asserts the new ContentJ.txt and BundleResourceJ.txt resources appear in the expected app bundle contents. |
| tests/dotnet/BundleStructure/ContentJ.txt | New test input file for Content + PublishFolderType=Resource. |
| tests/dotnet/BundleStructure/BundleResourceJ.txt | New test input file for BundleResource + PublishFolderType=Resource. |
✅ [CI Build #61c4183] Build passed (Build packages) ✅Pipeline on Agent |
✅ [PR Build #61c4183] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
✅ [CI Build #61c4183] Build passed (Build macOS tests) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🔥 [CI Build #61c4183] Test results 🔥Test results❌ Tests failed on VSTS: test results 1 tests crashed, 0 tests failed, 151 tests passed. Failures❌ Tests on macOS Tahoe (26) tests🔥 Failed catastrophically on VSTS: test results - mac_tahoe (no summary found). Html Report (VSDrops) Download Successes✅ cecil: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
In multi-RID (universal) builds, the outer build saves all Content and BundleResource
items to processed-items files, and inner builds remove them. However, items with
PublishFolderType are not actually processed by CollectBundleResources (it skips
them) — they're handled via ResolvedFileToPublish instead. By incorrectly saving
them as processed, the inner builds remove them before they can be added to ResolvedFileToPublish,
so they never end up in the app bundle.
Fix by filtering out items with PublishFolderType when writing the processed-items
files.
Fixes #25053.