Skip to content

[targets] Improve/fix post-processing item collection for dylibs and frameworks#24721

Draft
rolfbjarne wants to merge 8 commits intomainfrom
dev/rolf/post-processing-tests
Draft

[targets] Improve/fix post-processing item collection for dylibs and frameworks#24721
rolfbjarne wants to merge 8 commits intomainfrom
dev/rolf/post-processing-tests

Conversation

@rolfbjarne
Copy link
Member

Fix several issues in the _CollectItemsForPostProcessing target:

  • Fix broken MSBuild syntax: '$(AppBundleExtension/' was missing the closing ')' for the property expression.
  • Fix broken condition: '%(_ResolvedNativeReference.Kind' was missing the closing ')'.
  • Use unqualified %(Kind) metadata in conditions, because %(ItemType.Metadata) doesn't work in Condition attributes on items created with @(Item->'...') transforms.
  • Change dylib source from _ResolvedNativeReference (which only contains frameworks) to _FileNativeReference (which contains dylibs).
  • Add _AppContentsRelativePathForPostProcessing property with trailing '/' separator to fix path concatenation for macOS (where _AppContentsRelativePath has no trailing separator).
  • Set DSymName directly on framework and dylib items to avoid MSB4096 batching error when items without Kind metadata (the executable) are in the same item group.
  • Add tests for dylib and framework post-processing items on iOS and macOS.

Improvements:

  • Make it easier to plug into this mechanism for other code to add items for post processing.
  • Fix an issue where dynamic native references were collected as if they were frameworks.
  • Simplify some defaults by computing them globally.
  • Add tests.

rolfbjarne and others added 3 commits February 17, 2026 11:15
…frameworks

Fix several issues in the _CollectItemsForPostProcessing target:

* Fix broken MSBuild syntax: '$(AppBundleExtension/' was missing the closing ')' for the property expression.
* Fix broken condition: '%(_ResolvedNativeReference.Kind' was missing the closing ')'.
* Use unqualified %(Kind) metadata in conditions, because %(ItemType.Metadata) doesn't work in Condition attributes on items created with @(Item->'...') transforms.
* Change dylib source from _ResolvedNativeReference (which only contains frameworks) to _FileNativeReference (which contains dylibs).
* Add _AppContentsRelativePathForPostProcessing property with trailing '/' separator to fix path concatenation for macOS (where _AppContentsRelativePath has no trailing separator).
* Set DSymName directly on framework and dylib items to avoid MSB4096 batching error when items without Kind metadata (the executable) are in the same item group.
* Add tests for dylib and framework post-processing items on iOS and macOS.

Improvements:

* Make it easier to plug into this mechanism for other code to add items for post processing.
* Fix an issue where dynamic native references were collected as if they were frameworks.
* Simplify some defaults by computing them globally.
* Add tests.
Move AssertExpectedDSyms to TestBaseClass for reuse across test classes.

Add dSYM verification to DylibPostProcessingItems and
FrameworkPostProcessingItems tests: since these are Debug builds, verify
that no dSYM directories are generated.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The BundleStructure project includes Framework.With.Dots.framework,
which causes dsymutil to fail because the framework binary name is
truncated. This prevents dSYMs from being generated for all items in the
app bundle. Add an ignored test to make it easy to reproduce the problem.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes and refactors the _CollectItemsForPostProcessing MSBuild target used to collect binaries (frameworks/dylibs/executable) for dsymutil + stripping, and adds unit tests to validate the collected items and dSYM outputs across iOS and macOS.

Changes:

  • Refactors _CollectItemsForPostProcessing dependencies and item collection to correctly handle frameworks vs dylibs and fix prior MSBuild syntax/condition issues.
  • Adds more robust dSYM assertions (bundle-wide) and new binlog-based tests validating _PostProcessingItem entries for dylibs/frameworks.
  • Extends app size tests to validate expected dSYM directories in the build output.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tests/dotnet/UnitTests/TestBaseClass.cs Adds AssertExpectedDSyms helper to validate dSYM directories expected from bundle contents.
tests/dotnet/UnitTests/PostBuildTest.cs Adds binlog-based tests verifying post-processing items for dylibs/frameworks and expected DSymName metadata.
tests/dotnet/UnitTests/AppSizeTest.cs Adds dSYM presence/absence validation to app size build assertions.
msbuild/Xamarin.Shared/Xamarin.Shared.targets Refactors post-processing item collection (frameworks/dylibs), adds path helper property, and sets DSymName defaults/overrides.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

rolfbjarne and others added 2 commits February 17, 2026 22:12
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…sing

The dSYMSourcePath for dylibs was computed using GetDirectoryName, which
returns the parent directory. For a dylib at /path/to/libfoo.dylib, this
resulted in /path/to.dSYM instead of the correct /path/to/libfoo.dylib.dSYM.

Fix by using %(Identity).dSYM directly for dylibs, and add dSYMSourcePath
validation to both the DylibPostProcessingItems and FrameworkPostProcessingItems
tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

The .NET runtime dylibs (from Microsoft.NETCore.App.Runtime.* NuGet
packages) may contain symbols referenced by indirect symbol table
entries that can't be stripped. Set NoSymbolStrip=true for these items
in _CollectItemsForPostProcessing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Frameworks are now properly collected for post-processing (strip),
which causes their binaries to be synced back to the Windows bin
directory during remote builds. The FrameworksInRuntimesNativeDirectory
test frameworks have paths of 118 characters.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #ad898b6] Build passed (Build packages) ✅

Pipeline on Agent
Hash: ad898b6088515b818c135ae611df9cfe020be6ea [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #ad898b6] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: ad898b6088515b818c135ae611df9cfe020be6ea [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: ad898b6088515b818c135ae611df9cfe020be6ea [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #ad898b6] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: ad898b6088515b818c135ae611df9cfe020be6ea [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #ad898b6] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: ad898b6088515b818c135ae611df9cfe020be6ea [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #ad898b6] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: ad898b6088515b818c135ae611df9cfe020be6ea [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #ad898b6] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: ad898b6088515b818c135ae611df9cfe020be6ea [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #ad898b6] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: ad898b6088515b818c135ae611df9cfe020be6ea [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #ad898b6] Tests on macOS arm64 - Mac Tahoe (26) passed 💻

All tests on macOS arm64 - Mac Tahoe (26) passed.

Pipeline on Agent
Hash: ad898b6088515b818c135ae611df9cfe020be6ea [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [CI Build #ad898b6] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 131 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 6 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (iOS): All 11 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 12 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (tvOS): All 11 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: ad898b6088515b818c135ae611df9cfe020be6ea [PR build]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments