Skip to content

Commit

Permalink
chore: Apply suggestions from review
Browse files Browse the repository at this point in the history
Co-authored-by: Andres Pineda <1900897+ajpinedam@users.noreply.github.com>
  • Loading branch information
spouliot and ajpinedam authored Dec 10, 2024
1 parent 0fe51b6 commit a666cab
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
14 changes: 7 additions & 7 deletions doc/articles/uno-publishing-desktop-macos-advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ You can create a basic `Info.plist` file yourself, using any text editor. The co
</plist>
```

You can edit the `Info.plist` file, add any required entries (for permissions), and let other fields empty. The basic, empty fields will be filled automatically by the `msbuild` task based on your project.
You can edit the `Info.plist` file, add any required entries (for permissions), and leave other fields empty. The basic, empty fields will be filled automatically by the `msbuild` task based on your project.

Then from the CLI run:

Expand Down Expand Up @@ -102,7 +102,7 @@ dotnet publish -f net8.0-desktop -p:SelfContained=true -p:PackageFormat=app -p:U

### Trimming

App bundles that are distributed should be self-contained applications that depends only on the OS to execute. However bundling the dotnet runtime, base class libraries and Uno Platform libraries produce a rather large application size.
App bundles that are distributed should be self-contained applications that depend only on the OS to execute. However bundling the dotnet runtime, base class libraries and Uno Platform libraries produce a rather large application size.

To reduce the size of the app bundle you can enable dotnet's [trimming](https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options#enable-trimming) when publishing the app, using `-p:PublishTrimmed=true`. The full command from the CLI would be:

Expand All @@ -115,11 +115,11 @@ dotnet publish -f net8.0-desktop -p:SelfContained=true -p:PackageFormat=app -p:P
### Optional files

`dotnet publish` include several files that are not strictly required to execute your application. To reduce the app bundle size most of those files are **not** included, by default, inside the app bundles.
`dotnet publish` includes several files that are not strictly required to execute your application. To reduce the app bundle size most of those files are **not** included, by default, inside the app bundles.

#### Including dotnet `createdump` tool

Useful for debugging, the `createdump` executable is rarely used by the consumers of the application and, by default, is not included in the app bundle.
Although useful for debugging, the `createdump` executable is rarely used by the application's consumers and, by default, is not included in the app bundle.

If you wish to include `createdump` inside your app bundle add the `-p:UnoMacOSIncludeCreateDump=true` on the CLI.

Expand Down Expand Up @@ -149,9 +149,9 @@ dotnet publish -f net8.0-desktop -p:SelfContained=true -p:PackageFormat=app -p:U

#### Including assemblies debugging symbols (.pdb) files

dotnet debugging symbols (`.pdb`) are generally included in released applications since it helps to provide better stack trace and help developers resolving issues. As such they are, by default, included inside the app bundle.
dotnet debugging symbols (`.pdb`) are generally included in released applications since they help to provide better stack traces and help developers resolve issues. As such, they are, by default, included inside the app bundle.

If you wish to remove them anyway you can do so by adding the `-p:UnoMacOSIncludeDebugSymbols=false` on the CLI.
If you wish to remove them anyway, you can do so by adding the `-p:UnoMacOSIncludeDebugSymbols=false` on the CLI.

```bash
dotnet publish -f net8.0-desktop -p:SelfContained=true -p:PackageFormat=app -p:UnoMacOSIncludeDebugSymbols=false
Expand All @@ -169,7 +169,7 @@ dotnet publish -f net8.0-desktop -p:SelfContained=true -p:PackageFormat=dmg -p:U

### Additional Customization

Further disk image customization is possible but can be tricky since it requires modification to the `.DS_Store` binary file inside the disk image (a lot of trials and errors). If more control is required (e.g. icon positioning, background image...) we recommend the use of 3rd party tools created specifically for this purpose. Some free/open source examples are:
Further disk image customization is possible but can be tricky since it requires modification to the `.DS_Store` binary file inside the disk image (many trials and errors). If more control is required (e.g. icon positioning, background image...) we recommend using 3rd party tools created specifically for this purpose. Some free/open source examples are:

- [create-dmg](https://github.com/sindresorhus/create-dmg)
- [dmgbuild](https://dmgbuild.readthedocs.io/en/latest/)
26 changes: 13 additions & 13 deletions doc/articles/uno-publishing-desktop-macos.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ To ensure the integrity of the app bundle Apple requires you to digitally sign y
dotnet publish -f net8.0-desktop -r osx-arm64 -p:SelfContained=true -p:PackageFormat=app -p:CodesignKey={{identity}}
```

You can use the special identity `-` to produce an adhoc signature. This basically tells macOS's [Gatekeeper](https://support.apple.com/en-us/102445) that the file is safe to use **locally**, however this does not help for distributing the app bundle.
You can use the special identity `-` to produce an adhoc signature. This basically tells macOS's [Gatekeeper](https://support.apple.com/en-us/102445) that the file is safe to use **locally**, however, it does not help distribute the app bundle.

> [!NOTE]
> Beside needed access to the Internet the code signing process slows down the builds. For local testing of your app you do not need to sign the app bundle.
#### How to find your identity

If you have not already you need to create your [developer certificates](https://developer.apple.com/help/account/create-certificates/create-developer-id-certificates/). Once you have created on your Mac computer them you can find your identities, from the CLI, by running:
If you have not already, you need to create your [developer certificates](https://developer.apple.com/help/account/create-certificates/create-developer-id-certificates/). Once you have created them, on your Mac computer, you can find your identities from the CLI, by running:

```bash
security find-identity -v
Expand Down Expand Up @@ -91,10 +91,10 @@ From the CLI run:
dotnet publish -f net8.0-desktop -r {{RID}} -p:SelfContained=true -p:PackageFormat=pkg -p:CodesignKey={{identity}} -p:PackageSigningKey={{installer_identity}}
```

Where the following changes to the previous command are
Where the following changes to the previous command are:

- modifying `PackageFormat` to `pkg` to produce the package. This package will include the the app bundle inside it, so the `CodesignKey` argument is still required;
- adding `-p:PackageSigningKey={{installer_identity}}` to specify which identity should be used to sign the package. Unlike app bundles the signing step requires the use of a `Developer ID Installer: *` identity.
- modifying `PackageFormat` to `pkg` to produce the package. This package will include the app bundle inside it, so the `CodesignKey` argument is still required;
- adding `-p:PackageSigningKey={{installer_identity}}` to specify which identity should be used to sign the package. Unlike app bundles, signing requires a `Developer ID Installer: *` identity.

The resulting installer will be located at `bin/Release/net8.0-desktop/{{RID}}/publish/{{APPNAME}}.pkg`.

Expand All @@ -103,9 +103,9 @@ The resulting installer will be located at `bin/Release/net8.0-desktop/{{RID}}/p
#### Notarize the package

Having both the app bundle (.app) and installer (.pkg) signed is not quite enough. As the package is a binary that you'll share with customers it needs to be notarized by Apple.
Having both the app bundle (.app) and installer (.pkg) signed is insufficient. As the package is binary and you'll share it with customers, Apple must also notarize it.

The first step is the store your Apple Account credentials inside the key store. This makes all the further commands (and notarization) much simpler. From the CLI run:
The first step is to store your Apple Account credentials inside the key store. This makes all the further commands (and notarization) much simpler. From the CLI run:

```bash
xcrun notarytool store-credentials {{notarytool-credentials}} --apple-id john.appleby@platform.uno --team-id XXXXXXXXXX --password aaaa-bbbb-cccc-dddd
Expand All @@ -130,7 +130,7 @@ Credentials saved to Keychain.
To use them, specify `--keychain-profile "notarytool-credentials"`
```

Once this (one time) setup is done you can notarize the disk image while building the app. From the CLI run:
Once this (one-time) setup is done, you can notarize the disk image while building the app. From the CLI run:

```bash
dotnet publish -f net8.0-desktop -r {{RID}} -p:SelfContained=true -p:PackageFormat=dmg -p:CodesignKey={{identity}} -p:PackageSigningKey={{installer_identity}} -p:UnoMacOSNotarizeKeychainProfile={{notarytool-credentials}} -bl
Expand Down Expand Up @@ -158,16 +158,16 @@ dotnet publish -f net8.0-desktop -r {{RID}} -p:SelfContained=true -p:PackageForm

Where the following changes to the original command are

- modifying `PackageFormat` to `dmg` to produce the disk image. This image will include the the app bundle inside it, so the `CodesignKey` argument is still required;
- adding `-p:DiskImageSigningKey={{identity}}` to specify which identity should be used to sign the package. Like app bundles the signing step requires the use of a `Developer ID Application: *` identity.
- modifying `PackageFormat` to `dmg` to produce the disk image. This image will include the app bundle inside it, so the `CodesignKey` argument is still required;
- adding `-p:DiskImageSigningKey={{identity}}` to specify which identity should be used to sign the package. Like app bundles, the signing step requires using a `Developer ID Application: *` identity.

The resulting disk image will be located at `bin/Release/net8.0-desktop/{{RID}}/publish/{{APPNAME}}.dmg`.

#### Notarize the disk image

Like an installer (.pkg) a disk image is the outermost container that you'll share with customers and, as such, needs to be notarized by Apple.

The first step is the store your Apple Account credentials inside the key store. This makes all the further commands (and notarization) much simpler. From the CLI run:
The first step is to store your Apple Account credentials inside the key store. This makes all the further commands (and notarization) much simpler. From the CLI run:

```bash
xcrun notarytool store-credentials {{notarytool-credentials}} --apple-id john.appleby@platform.uno --team-id XXXXXXXXXX --password aaaa-bbbb-cccc-dddd
Expand All @@ -192,7 +192,7 @@ Credentials saved to Keychain.
To use them, specify `--keychain-profile "notarytool-credentials"`
```

Once this (one time) setup is done you can notarize the disk image while building the app. From the CLI run:
Once this (one-time) setup is done, you can notarize the disk image while building the app. From the CLI run:

```bash
dotnet publish -f net8.0-desktop -r {{RID}} -p:SelfContained=true -p:PackageFormat=dmg -p:CodesignKey={{identity}} -p:DiskImageSigningKey={{identity}} -p:UnoMacOSNotarizeKeychainProfile={{notarytool-credentials}} -bl
Expand All @@ -211,7 +211,7 @@ Once completed you can distribute the notarized disk image.
### Mac App Store

> [!IMPORTANT]
> Application distributed on the Mac App Store are required to execute under a [sandbox](https://developer.apple.com/documentation/security/app-sandbox?language=objc) which impose additional limits on how applications can interact with the computer.
> Applications distributed on the Mac App Store are required to execute under a [sandbox](https://developer.apple.com/documentation/security/app-sandbox?language=objc), which imposes additional limits on how applications can interact with the computer.
An app bundle (.app) can be submitted to Apple's [App Store](https://www.apple.com/app-store/) using the [transporter app](https://developer.apple.com/help/app-store-connect/manage-builds/upload-builds) from a computer running macOS.

Expand Down

0 comments on commit a666cab

Please sign in to comment.