[msbuild] Copy the .dSYM to the publish directory when publishing#26041
[msbuild] Copy the .dSYM to the publish directory when publishing#26041rolfbjarne wants to merge 2 commits into
Conversation
When running `dotnet publish`, the generated `*.dSYM` directories (which are created next to the app bundle in the output directory) are now copied into the publish directory, so the debug symbols end up alongside the published `.ipa`/`.pkg`. This makes it much easier to locate the dSYMs for symbolication without knowing the exact build output layout. This can be disabled by setting `CopyDSYMToPublishDirectory=false`. Fixes #15384 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Avoid a potentially huge string-join in the log message when there are many files inside the .dSYM directories. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
✅ 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 #7fc8531] Test results 🔥Test results❌ Tests failed on VSTS: test results 1 tests crashed, 2 tests failed, 196 tests passed. Failures❌ dotnettests tests (iOS)🔥 Failed catastrophically on VSTS: test results - dotnettests_ios (no summary found). Html Report (VSDrops) Download ❌ dotnettests tests (MacCatalyst)1 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download ❌ dotnettests tests (macOS)1 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download Successes✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
Developers frequently can't find the
.dSYMdebug symbols afterdotnet publish, because they're left in the build output directory (next to the.app) while the published.ipa/.pkglands in the publish directory. This trips people up when they need to symbolicate crashes or upload symbols to a crash reporting service, and it's a recurring source of confusion in issue #15384.This change copies any generated
*.dSYMdirectories into the publish directory duringdotnet publish, so the debug symbols end up right alongside the published package.Approach
_CopyDSymToPublishDirectorytarget indotnet/targets/Xamarin.Shared.Sdk.Publish.targets, wired into thePublishtarget viaDependsOnTargets(so it runs after the app bundle and its dSYMs already exist).GetDirectoriestask to find*.dSYMdirectories next to the app bundle ($(_AppContainerDir)), then copies each one recursively into$(PublishDir), preserving the dSYM folder name and internal structure.SkipUnchangedFilesavoids redundant copies on repeated publishes.CopyDSYMToPublishDirectoryproperty controls the behavior. It defaults totrue; set it tofalseto opt out.IsOSPlatform('osx')) and to projects that actually produce an app bundle. The Windows remote-build path already retrieves dSYMs separately viaCopyDSYMFromMac, so that flow is intentionally untouched.Notes for reviewers
%(RecursiveDir)to reproduce the tree. I could not run the full test suite locally (the environment is missing the required Xcode), so I validated the batching/RecursiveDirdestination mapping with a standalonedotnet msbuildrepro, and added aPublishDSymToPublishDirectorytest (copy on/off) totests/dotnet/UnitTests/PostBuildTest.cs.docs/building-apps/build-properties.md.Fixes: #15384
Fixes #15384
🤖 Pull request created by Copilot