Home/Without a Mac/How do I build an iOS ipa from a .NET MAUI app without a Mac?

How do I build an iOS ipa from a .NET MAUI app without a Mac?

Updated · airankrush

The short answer

Short answer: you can write the C# and XAML on Windows, but compiling and signing the iOS package has to be done by Xcode on a Mac. Visual Studio only hands the build to the Mac over SSH. On a remote Mac, we suggest logging in to the desktop and building there.

Which steps require macOS

What cannot leave macOS

  • Microsoft's documentation states that building native iOS apps requires Apple's build tools, and those tools only run on a Mac. Visual Studio on Windows uses Pair to Mac to call the tools on the Mac over SSH for compiling and signing. The Mac is still required.
  • Xcode has to be installed by hand and opened once. Pair to Mac installs .NET and other components automatically, but the documentation says explicitly that it cannot install Xcode.

What you can finish on Windows first

  • App code, UI, and debugging of the Android and Windows targets.
  • Project file properties such as ApplicationId, ApplicationDisplayVersion and ApplicationVersion.

The practical limit of Pair to Mac with a remote Mac

Pair to Mac needs Remote Login turned on on the Mac, and the Mac has to be reachable from your Windows machine over the network: on the same network it is discovered automatically, otherwise you enter the Mac's IP by hand. The connection methods we provide are UU Remote and RustDesk. Your admin account lets you turn on Remote Login yourself in System Settings, but you may not change the network configuration. Whether the machine's SSH port can be reached from the public internet depends on the delivery notes, so check with support before ordering. Do not assume Pair to Mac will work. The steps below are written for working on the remote Mac's desktop.

How to do it on a remote Mac

  1. Connect to the remote Mac and install Xcode and .NET

    Follow the UU Remote connection guide to reach the desktop. After installing Xcode, open it once so it can finish installing its additional components. Each MAUI release matches a specific Xcode version. The mapping is on the official Release versions page. Check it before installing rather than grabbing the newest Xcode.

    Then install the .NET SDK and the MAUI workload: dotnet workload install maui. On macOS, Microsoft's documentation requires running this command with administrator privileges. The full form is in the installation docs. Afterwards, run dotnet workload list and confirm maui is in the list.

  2. Pull the code and get the simulator running first

    Clone the repository with Git, go to the directory of the MAUI app project (not the solution directory), and run:

    dotnet build -t:Run -f net8.0-ios

    net8.0-ios is the documentation's example. Replace it with the actual iOS target framework from your project's TargetFrameworks. This step restores dependencies, compiles, and launches the app in the default simulator. If it runs, the environment is fine. If you need an editor, install Visual Studio Code and the .NET MAUI extension.

  3. Prepare the distribution certificate and provisioning profile

    Producing an ipa needs a distribution certificate and an App Store provisioning profile, and the certificate's private key has to be in this Mac's keychain. The details are in MAUI certificates and signing.

  4. Run dotnet publish to produce the ipa

    The command form given in Microsoft's documentation:

    dotnet publish -f net8.0-ios -c Release -p:ArchiveOnBuild=true -p:RuntimeIdentifier=ios-arm64 -p:CodesignKey="Apple Distribution: Your Name (Team ID)" -p:CodesignProvision="Profile Name"

    The ipa is only generated with ArchiveOnBuild=true. On success the file is under bin/Release/<target framework>/ios-arm64/publish/. The first time you sign, macOS may show a dialog asking whether codesign may use the key in the keychain. Click Allow on the remote desktop.

  5. Put the signing parameters in the project file

    If you would rather not type the long command each time, add a conditional property group to the .csproj that only applies to the iOS Release configuration:

    <PropertyGroup Condition="$(TargetFramework.Contains('-ios')) and '$(Configuration)' == 'Release'">
      <CodesignKey>Apple Distribution: Your Name (Team ID)</CodesignKey>
      <CodesignProvision>Profile Name</CodesignProvision>
      <ArchiveOnBuild>true</ArchiveOnBuild>
    </PropertyGroup>

    Command-line parameters take precedence over values in the project file.

FAQ

dotnet publish fails when I run it against the .sln. What should I do?

Microsoft's documentation has a specific warning about this: running dotnet publish on a solution publishes every project in it one by one, which easily goes wrong when the solution contains other project types. Limit the command to the MAUI app project.

Can I keep using Visual Studio on Windows and pair it with the rented Mac?

Technically, Pair to Mac needs SSH access to the Mac, and command-line builds also pass parameters such as ServerAddress, ServerUser and TcpPort=58181. Being able to reach the remote Mac's SSH port from your network is not something we guarantee by default. Check with support before ordering. If it cannot be confirmed, build on the remote desktop as described on this page.

Can I produce an iOS build with no Mac at all?

Not on the Windows machine itself. Besides renting a Mac, the other route is a cloud build service with macOS build machines, running the same dotnet publish in a pipeline. For how to choose between the two, see remote Mac vs cloud build. Hot Restart in Visual Studio 2022 does not need a Mac, but the documentation states it can only deploy the Debug configuration. Production builds still need a Mac build host.

How long does the first build take?

It has to download Xcode, the .NET workloads and all NuGet dependencies, so it is clearly slower than later incremental builds. Download speed depends on the network route. We have no measured data and make no promise about duration. For machine specs and stock, see the plans page.

Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support

Back to home · All no-Mac guides