publish app in mac

Dani_S 3,786 Reputation points
2024-05-29T07:47:18.4366667+00:00

Hi,

How do i publish my app in mac ?

In windows i did:

dotnet publish -f net8.0-windows10.0.19041.0 -c Release -p:WindowsPackageType=None -p:WindowsAppSDKSelfContained=true /p:PackageCertificateThumbprint="c01ba45666762f3615cf6813aeb4dc4b1919541d" -p:RuntimeIdentifierOverride=win10-x64

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,579 questions
{count} votes

Accepted answer
  1. THE ARIN KAMBLE 80 Reputation points
    2024-06-23T19:13:21.8866667+00:00

    You can publish your .NET app on macOS by running the dotnet publish command in the Terminal with different parameters. Here is a step-by-step guide to walk you through the process.

    Step-by-Step Guide

    Install .NET SDK:

    Make sure that the .NET SDK is installed on your macOS; you may download it from the official website of .NET.

    Open Terminal:

    Open the Terminal application on your Mac.

    Go to Your Project Directory:

    Change to the directory that contains.NET Core project with the cd command.

    sh

    Copy code

    cd /path/to/your/project

    Publish Your App:

    Run the following command to publish your app with dotnet publish and pass the framework, runtime identifier (RID), and configuration. For macOS, RID is typically osx-x64 or osx-arm64 based on your Mac architecture.

    sh

    Copy code

    dotnet publish -f net8.0 -r osx-x64 -c Release --self-contained

    This command tells dotnet publish to:

    -f net8.0: target .NET Framework 8.0.

    -r osx-x64: This is the runtime identifier for macOS. Use osx-arm64 for Apple Silicon Macs.

    -c Release: This sets the configuration to Release.

    --self-contained: With this flag, a self-contained application is created, including the .NET runtime.

    Finding Published Fils:

    Once it has finished publishing your app, you can find it in the bin/Release/net8.0/osx-x64/publish directory. If you specified osx-arm64 as the RID when publishing, then your app shall be located in osx-arm64.

    sh

    Copy code

    cd bin/Release/net8.0/osx-x64/publish

    Distribute Your App:

    The generated folder will contain all the files necessary to run your app on macOS. You can package the contents of that folder into a zip file for distribution, or you can use something like pkgbuild to create an installer package.

    Example Commands

    Here is an example of a complete set of commands you might run in Terminal:

    sh

    Copy code

    cd /path/to/your/project

    dotnet publish -f net8.0 -r osx-x64 -c Release --self-contained

    cd bin/Release/net8.0/osx-x64/publish

    More Tips

    Apple Silicon Macs: This runtime identifier is osx-arm64 when targeting Apple Silicon Macs; otherwise, it is osx-x64.

    sh

    Copy code

    dotnet publish -f net8.0 -r osx-arm64 -c Release --self-contained

    Application Bundle: You might need to bundle your macOS-based applications under an application bundle (.app). You could do that by hand or with additional tools/Scripts.

    Signing and Notarization: Besides macOS distribution, specially for distribution outside the App Store, you should consider signing and notarizing your app to prevent security warnings.

    These steps should give you a reasonable chance of successfully publishing and distributing your .NET application for macOS.

    0 comments No comments

0 additional answers

Sort by: Most helpful

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.