Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to publish iOS Maui build on iOS device due to error when code signing

Tags:

ios

maui

We am working with migrating our Xamarin projects to Maui. We are able to build the project for both android and iOS platforms, but it only debugs on device for the android.

Ye are working on a Mac using the .NET Maui plugin in Visual Studio Code.

We've installed .NET 8, Xcode, vs code and android studio on a Mac.

The problem is that it is not able to sign the code for iOS.

    MSBuild version 17.8.3+195e7f5a3 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
  Detected signing identity:
          
    Code Signing Key: "Apple Development: Daniel Raniel (BXAUSAYH2W)" (AAF63DB7E4325D6388F6722C8CD11EA63A46E16D)
    Provisioning Profile: "Maui App Profile" (73af5ef6-7976-4faa-b148-c0c115501a27)
    Bundle Id: no.tellu.mauiapp1
    App Id: BM2KQ6ED8Q.no.tellu.mauiapp1
  MauiApp1 -> /Users/aacr3322/Documents/Workspace/testmaui/testmaui/MauiApp1/bin/Debug/net8.0-ios/ios-arm64/MauiApp1.dll
  Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
  Tool /usr/bin/codesign execution finished (exit code = 1).
          
  file with invalid attached data: Disallowed xattr com.apple.FinderInfo found on /Users/aacr3322/Documents/Workspace/testmaui/testmaui/MauiApp1/bin/Debug/net8.0-ios/ios-arm64/MauiApp1.app
  
  /Users/aacr3322/Documents/Workspace/testmaui/testmaui/MauiApp1/bin/Debug/net8.0-ios/ios-arm64/MauiApp1.app: resource fork, Finder information, or similar detritus not allowed
  
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.0.8490/tools/msbuild/iOS/Xamarin.Shared.targets(2256,3): error : /usr/bin/codesign exited with code 1: [/Users/aacr3322/Documents/Workspace/testmaui/testmaui/MauiApp1/MauiApp1.csproj::TargetFramework=net8.0-ios]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.0.8490/tools/msbuild/iOS/Xamarin.Shared.targets(2256,3): error : /Users/aacr3322/Documents/Workspace/testmaui/testmaui/MauiApp1/bin/Debug/net8.0-ios/ios-arm64/MauiApp1.app: resource fork, Finder information, or similar detritus not allowed [/Users/aacr3322/Documents/Workspace/testmaui/testmaui/MauiApp1/MauiApp1.csproj::TargetFramework=net8.0-ios]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.0.8490/tools/msbuild/iOS/Xamarin.Shared.targets(2256,3): error : Failed to codesign '/Users/aacr3322/Documents/Workspace/testmaui/testmaui/MauiApp1/bin/Debug/net8.0-ios/ios-arm64/MauiApp1.app': /Users/aacr3322/Documents/Workspace/testmaui/testmaui/MauiApp1/bin/Debug/net8.0-ios/ios-arm64/MauiApp1.app: resource fork, Finder information, or similar detritus not allowed [/Users/aacr3322/Documents/Workspace/testmaui/testmaui/MauiApp1/MauiApp1.csproj::TargetFramework=net8.0-ios]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.0.8490/tools/msbuild/iOS/Xamarin.Shared.targets(2256,3): error :  [/Users/aacr3322/Documents/Workspace/testmaui/testmaui/MauiApp1/MauiApp1.csproj::TargetFramework=net8.0-ios]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.0.8490/tools/msbuild/iOS/Xamarin.Shared.targets(2256,3): error :          [/Users/aacr3322/Documents/Workspace/testmaui/testmaui/MauiApp1/MauiApp1.csproj::TargetFramework=net8.0-ios]

Build FAILED.

I have tried building with dotnet publish ... from the terminal but I get the same error. However, we are able to build the archive file in GitHub Actions, using the same dotnet command. We are also able to debug the app from VS Code in the simulator for iPhone 15.

I have seen that other people that are struggling with this in Xamarin have been using the xattr in the command line to solve the issue.

When I do

$ xattr -lr .

it lists a lot of files, which gets smaller by the proposed solution

$ xattr -cr .

However, some files still remains in the list when doing -lr after -cr

MacBook-Pro MauiApp1 % xattr -lr .
./bin 2/Debug/net8.0-ios: com.apple.fileprovider.dir#N: 1
./obj/Debug/net8.0-ios/ios-arm64/ibtool/MauiSplash.storyboardc: com.apple.FinderInfo: 
./obj/Debug/net8.0-ios/ios-arm64/ibtool/MauiSplash.storyboardc: com.apple.fileprovider.fpfs#P: 
./obj/Debug/net8.0-ios/ios-arm64/strip/MauiApp1.app: com.apple.FinderInfo: 
./obj/Debug/net8.0-ios/ios-arm64/strip/MauiApp1.app: com.apple.fileprovider.fpfs#P: 
./obj/Debug/net8.0-ios/ios-arm64/resizetizer/r/Assets.xcassets/appicon.appiconset: com.apple.fileprovider.dir#N: 1
./obj/Debug/net8.0-ios/ios-arm64/resizetizer/r/Assets.xcassets: com.apple.fileprovider.dir#N: 1
./obj/Debug/net8.0-ios/ios-arm64/actool/cloned-assets/Assets.xcassets/appicon.appiconset: com.apple.fileprovider.dir#N: 1
./obj/Debug/net8.0-ios/ios-arm64/actool/cloned-assets/Assets.xcassets: com.apple.fileprovider.dir#N: 1
./obj/Debug/net8.0-ios: com.apple.fileprovider.dir#N: 1
./bin/Debug/net8.0-ios/ios-arm64/MauiApp1.app/Settings.bundle: com.apple.FinderInfo: 
./bin/Debug/net8.0-ios/ios-arm64/MauiApp1.app/Settings.bundle: com.apple.fileprovider.fpfs#P: 
./bin/Debug/net8.0-ios/ios-arm64/MauiApp1.app/MauiSplash.storyboardc: com.apple.FinderInfo: 
./bin/Debug/net8.0-ios/ios-arm64/MauiApp1.app/MauiSplash.storyboardc: com.apple.fileprovider.fpfs#P: 
./bin/Debug/net8.0-ios/ios-arm64/MauiApp1.app: com.apple.FinderInfo: 
./bin/Debug/net8.0-ios/ios-arm64/MauiApp1.app: com.apple.fileprovider.fpfs#P: 
./bin/Debug/net8.0-ios/ios-arm64/MauiApp1.app.dSYM: com.apple.FinderInfo: 
./bin/Debug/net8.0-ios/ios-arm64/MauiApp1.app.dSYM: com.apple.fileprovider.fpfs#P: 
./bin/Debug/net8.0-ios: com.apple.fileprovider.dir#N: 1

Any thoughts on what the issue may be?

like image 853
Smorka Avatar asked Dec 22 '25 06:12

Smorka


1 Answers

The cause of this error seems to be related to some meta/temp files in iCloud. I had my code checked out in a subfolder of Documents, which is backed up by iCloud.

Once I checked out the code in a folder outside of Documents, it built and signed successfully both in Visual Studio Code and from Command line.

Device Debugging worked as well.

like image 144
Smorka Avatar answered Dec 23 '25 20:12

Smorka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!