liveBook · Manning

Dotnet publish

As explained in .NET MAUI in Action

dotnet publish is a .NET CLI command that compiles, packages, and prepares a .NET application for deployment.

dotnet publish prepares a .NET application for deployment by publishing a project with a target framework and configuration. In a GitHub Actions Android job, it replaces dotnet build and creates a signed AAB. section 12.2.2

A practical publishing workflow can:

  • Specify the project path, Android target framework, and Release configuration. section 12.2.2
  • Pass Android signing settings through to MSBuild with /p: arguments, including the keystore path, passwords, alias, and signing flag. section 12.2.2
  • Upload the resulting signed AAB as a GitHub Actions artifact for a later deployment job. section 12.2.2

Publish and sign an Android app

dotnet publish src/Presentation/MauiStockTake.UI/MauiStockTake.UI.csproj -f:net7.0-android -c:Release /p:AndroidKeyStore=True /p:AndroidSigningKeyStore="${{ github.workspace }}/mauistocktake.keystore" /p:AndroidSigningKeyPass=${{ secrets.ANDROID_KEYPASSWORD }} /p:AndroidSigningKeyAlias=${{ secrets.ANDROID_KEYSTOREALIAS }} /p:AndroidSigningStorePass=${{ secrets.ANDROID_KEYSTOREPASSWORD }} section 12.2.2

Figure 12.10 The dotnet publish command is similar to the dotnet build command we saw in chapter 2. You provide the path to the project to be published, the target framework and configuration, and any additional MSBuild arguments.

Command anatomy showing the project path, target framework, configuration, and additional MSBuild arguments. section 12.2.2

How .NET MAUI in Action covers it

How deep it goes
Explains command options and MSBuild pass-through arguments, but stops short of describing publish internals.
Examples
Uses a .NET MAUI Android project, a keystore, signing secrets, a signed AAB, and an uploaded GitHub Actions artifact.
What it assumes
Assumes familiarity with .NET CLI build commands, GitHub Actions workflows, Android keystores, and repository secrets.
What you can do after
Operate/configure dotnet publish to produce and sign an Android AAB in a GitHub Actions workflow.
How it connects
Connects project paths, target frameworks, Release configuration, MSBuild, Android signing, GitHub Actions, and deployment artifacts.

Also explained in

Compare how 2 books explain dotnet publish →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of .NET MAUI in Action. The section links point to the parts of the book it draws on.