How to fix .NET MAUI Blazor Hybrid app code object is not signed at all issue in Mac M2 when Building for iOS?

Gayantha Anushan 0 Reputation points
2024-07-29T03:35:57.23+00:00

Our company created .NET MAUI application for ERP purpose. currently it deploying to android and windows as well and those are working fine. we started it from .NET 7 and currently we are using .NET 8 as well. when I trying to build it for iOS I got several issues and I fixed most of the things. but I got issue that cannot find a resource to fix that.

here is description of my environment. I developing using windows pc but building for windows and android was done using CI/CD pipeline now. previously I used to windows PC for build that platforms. for iOS I tried to build using iOS using XCode latest and dotnet 8 for mac arm64 devices and apple m2 MacBook as well. but I cannot directly connect my MacBook and windows pc. there are too much lessons for develop by connecting windows and MacBook. so I tried to build it from MacBook itself. it seems working but I got error below. I need to fix that but I couldn't find any way to fix that.

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.2.8078/tools/msbuild/iOS/Xamarin.Shared.targets(2257,3): error : /usr/bin/codesign exited with code 1: [<Project_path>/bluelotus360.com.mauiBlazor.csproj::TargetFramework=net8.0-ios] 

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.2.8078/tools/msbuild/iOS/Xamarin.Shared.targets(2257,3): error : <Project_path>/bin/Release/net8.0-ios/ios-arm64/bluelotus360.com.mauiBlazor.app: code object is not signed at all [<Project_path>/bluelotus360.com.mauiBlazor.csproj::TargetFramework=net8.0-ios] 

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.2.8078/tools/msbuild/iOS/Xamarin.Shared.targets(2257,3): error : In subcomponent: <Project_path>/bin/Release/net8.0-ios/ios-arm64/bluelotus360.com.mauiBlazor.app/System.Xml.Linq.dll [<Project_path>/bluelotus360.com.mauiBlazor.csproj::TargetFramework=net8.0-ios] 

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.2.8078/tools/msbuild/iOS/Xamarin.Shared.targets(2257,3): error : Failed to codesign '<Project_path>/bin/Release/net8.0-ios/ios-arm64/bluelotus360.com.mauiBlazor.app': <Project_path>/bin/Release/net8.0-ios/ios-arm64/bluelotus360.com.mauiBlazor.app: code object is not signed at all [<Project_path>/bluelotus360.com.mauiBlazor.csproj::TargetFramework=net8.0-ios] 

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.2.8078/tools/msbuild/iOS/Xamarin.Shared.targets(2257,3): error : In subcomponent: <Project_path>/bin/Release/net8.0-ios/ios-arm64/bluelotus360.com.mauiBlazor.app/System.Xml.Linq.dll [<Project_path>/bluelotus360.com.mauiBlazor.csproj::TargetFramework=net8.0-ios] 

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.2.8078/tools/msbuild/iOS/Xamarin.Shared.targets(2257,3): error :  [<Project_path>/bluelotus360.com.mauiBlazor.csproj::TargetFramework=net8.0-ios] 

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/17.2.8078/tools/msbuild/iOS/Xamarin.Shared.targets(2257,3): error :          [<Project_path>/bluelotus360.com.mauiBlazor.csproj::TargetFramework=net8.0-ios] 

here is terminal code I used

dotnet publish -f net8.0-ios -c Release
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,922 questions
Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,596 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,596 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,015 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 32,386 Reputation points Microsoft Vendor
    2024-07-29T07:02:13.2433333+00:00

    Hello,

    To publish an iOS app, you must have a Mac and an Apple Developer Program for creating an App Store distribution provisioning profile.

    1. Create a distribution certificate. For more information, see Create a distribution certificate.
    2. Create an App ID. For more information, see Create an App ID.
    3. Create a provisioning profile. For more information, see Create a provisioning profile.

    For more details, please refer to Publish a .NET MAUI iOS app for App Store distribution - .NET MAUI | Microsoft Learn (You can publish the app by VS directly)

    Also, you can use the following command:

    dotnet publish -f net8.0-ios -c Release -p:ArchiveOnBuild=true -p:RuntimeIdentifier=ios-arm64 -p:CodesignKey="XXX" -p:CodesignProvision="XXX"
    

    Best Regards,

    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.