How to generate .dSYM file for .NET MAUI app

315 Views Asked by At

How do I generate symbols file for my .NET MAUI app?

Is it this setting?

<MtouchNoSymbolStrip>True</MtouchNoSymbolStrip>

Right clicked project and selected Properties. Under iOS > Build, I unchecked Symbols. It was originally checked.

enter image description here

I tried building/publishing with that setting but I still don’t see a .dSYM file anywhere in the publish folder.

2

There are 2 best solutions below

2
VonC On BEST ANSWER

You are on Windows, and the .dSYM files are typically generated as part of the iOS build process when building from a Mac, or through a CI/CD pipeline configured for iOS builds, such as GitHub Actions. While you can develop .NET MAUI apps on Windows, for iOS builds, especially to generate .dSYM files, you often need to be on a Mac or use a CI/CD system that runs on macOS.

The <MtouchNoSymbolStrip> setting is related but might not directly influence the generation of .dSYM files. Instead, make sure your iOS project is configured to include debug symbol generation during the build. That is typically controlled by the compiler and linker settings in the iOS project properties.
Make sure the "Debug Information" option in your project settings is correctly set up. For Visual Studio on macOS, this can be found under the iOS build settings. Make sure it is set to generate full debug information.

Since you are on Windows, try and build your app on GitHub using Actions, making sure your workflow is configured to run on a macOS runner (like the recent Q1 2024 macOS 14 (Sonoma) image runner), and explicitly include steps to archive and upload the .dSYM files as artifacts. That might involve custom scripting within your GitHub Actions workflow to locate and package these files post-build.

- name: Archive dSYM files
  run: |
    zip -r dSYMs.zip ${{github.workspace}}/YourAppPath/bin/iPhone/Release/*.app.dSYM
- name: Upload dSYM Artifact
  uses: actions/upload-artifact@v2
  with:
    name: dSYMs
    path: dSYMs.zip

See also SideStore/SideStore workflow as an example, with its Makefile setting DWARF_DSYM_FOLDER_PATH (see this thread on the default value of DWARF_DSYM_FOLDER_PATH being $(CONFIGURATION_BUILD_DIR)).


I'm still struggling with this. I was able to incorporate the steps you mentioned into my GitHub action, but it produced an empty dSYMs.zip file. I also found a setting under project properties to include symbols which adds <IncludeSymbols>True</IncludeSymbols> to csproj file, but this didn't have any effect either. I am not sure if the symbol’s file is being generated at all, or I'm unable to locate it to archive it.

You would need to troubleshoot this: assuming your project's build configuration is set up correctly to generate symbols, and set to generate full debug information, double-check the location of .dSYM files (it should be in the same directory as the compiled application bundle).

- name: Find, Echo, and Archive dSYM files
  run: |
    find ${{github.workspace}} -name "*.dSYM" -print -exec echo "Found .dSYM at: {}" \; -exec zip -r dSYMs.zip {} +

Try also, in your GitHub Actions workflow, to list the contents of directories where you expect the .dSYM files to be generated (to confirm whether the .dSYM files are being created and where they are located)

- name: List output directory contents
  run: |
    ls -la ${{github.workspace}}/YourAppPath/bin/iPhone/Release/

See also "What's the dSYM and how to use it? (iOS SDK)", with this 2020 answer.

1
Brandon Minnick On

On macOS

The .dSYM file is generated automatically by Xcode when we publish a Release build of our iOS / MacCatalyst .NET MAUI apps on macOS .

For example, here is how to publish a .NET MAUI app for iOS:

dotnet publish -f net8.0-ios -c Release -p:ArchiveOnBuild=true -p:RuntimeIdentifier=ios-arm64 -p:CodesignKey="Apple Distribution: John Smith (AY2GDE9QM7)" -p:CodesignProvision="MyMauiApp"

After publishing the iOS/MacCatalyst app using dotnet publish, you can find + retrieve the .dSYM file using the following steps:

  1. Open Xcode
  2. In Xcode, in the menu bar, navigate to Window -> Organizer
    • Alternatively, in Xcode, use the keyboard shortcut cmd + option + shift + o
  3. In the Xcode Archives window, in the top left corner of the window, use the drop-down to select the app for which you want the .dsym file
  4. In the Xcode Archives window, on the left-hand menu, select Archives
  5. In the Xcode Archives window, locate the version of the published app
  6. In the right-click menu, select Show in Finder
  7. In Finder, locate the .xcarchive file, right-click -> Show Package Contents
  8. In Finder, you'll now find the dSYMS folder where you .dSYM file is located

enter image description here