Can we create native iOS XCFramework & Android jar files using c# maui code base?

Krishna Kishore Bandaru 0 Reputation points


Our plan is to generate iOS XCFramework & Android jar files using c# maui code base to re-use the functionality written in c#.

How to generate such libraries.

When I tried to generate the library using VS for Mac, I got dll & pdb files, not .xcFramework in iOS.

Can you help how to generate them.

A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,058 questions
Microsoft Intune iOS
Microsoft Intune iOS
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.iOS: An Apple mobile operating system.
195 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 37,506 Reputation points Microsoft Vendor


    This is not feasible. C# libraries are not compiled into XCFramework and Jar formats. If you have a need to reference C# in a native project, you can search for how to call the methods in the Dll on the respective platform.

    For native platform development with references to MAUI, it is more recommended that you create native .Net Android and iOS apps. In Visual Studio they are called Android Applition and iOS Application. Afterwards, you can embed references to MAUI in your native project with this document.

    Best Regards,

    Alec Liu.

    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.

    0 comments No comments

  2. Bruce ( 59,051 Reputation points

    What is your target audience for the libraries? Maui produces C native libraries with the C calling conventions. If you want to use them from native tools you should produce wrappers.

    For Maui projects, you should produce a Maui nuget package. this would include the dll plus binding libraries for IOS and Android.

    For android Java/Kotlin you should create a Java/Kotlin wrapper that calls the native library. this you could bundle into a jar file (including the dll(s)).

    for IOS Swift/Objective-C you should produce Swift wrapper for your library (the Swift code should also support Objective-C entry points if want the library usable by Objective-C). you can then build and sign a XCFramework bundle.

    0 comments No comments