Mac Connector for .NET iOS — Azure Pipelines
Build, sign and publish .NET MAUI / .NET iOS apps (.ipa) from a Windows pipeline agent on a networked Mac, over SSH.
The Mac needs no Azure Pipelines agent: it is used as a build host, like Visual Studio's Pair to Mac.
The task Mac Connector: iOS Build & Publish (MacConnectorIos@0):
- connects to the Mac with an SSH service connection;
- copies the sources to a folder for this run on the Mac;
- imports the certificate (
.p12) from Secure Files into a temporary keychain and installs the provisioning profile;
- runs
dotnet publish -f net9.0-ios -c Release -p:RuntimeIdentifier=ios-arm64 -p:ArchiveOnBuild=true … with live output; compiler errors and warnings appear as pipeline annotations on your files;
- downloads the
.ipa (and optionally the zipped dSYM) to the agent, e.g. $(Build.ArtifactStagingDirectory);
- optionally uploads the
.ipa to App Store Connect / TestFlight;
- always deletes the temporary keychain and the run folder on the Mac, also when the run fails or is cancelled.
It uses the same core as the Mac Connector VS Code extension, so builds behave identically on a developer PC and in CI.
Requirements
Windows agent (self-hosted, Windows 10/11 or Server 2019+): agent 3.232.1 or later (Node 20 tasks), tar.exe (built into Windows), and network access to the Mac's SSH port.
Android .apk / .aab builds keep running directly on the Windows agent with dotnet publish -f net9.0-android.
Mac
- Remote Login enabled: System Settings → General → Sharing → Remote Login. A dedicated build user is recommended.
- Xcode installed and opened once (license accepted):
sudo xcodebuild -license accept && sudo xcodebuild -runFirstLaunch.
- .NET SDK with the
ios (or maui) workload, same major version as your project: dotnet workload install ios maui-ios.
- The task checks all of this before building and fails with a clear message if something is missing.
Setup
- SSH key for the Mac. On any machine:
ssh-keygen -t ed25519 -f macbuild -C azure-pipelines. Append macbuild.pub to ~/.ssh/authorized_keys of the build user on the Mac.
- Service connection. Project settings → Service connections → New → SSH: host name (or IP) of the Mac, port (22), user name, and the private key (
macbuild). With a key, the Password field is the key's passphrase (leave empty if none).
- Secure Files. Pipelines → Library → Secure files: upload the distribution certificate (
.p12 with private key), the provisioning profile (.mobileprovision) and, for TestFlight, the App Store Connect API key (AuthKey_XXXX.p8). Authorize them for the pipeline.
- Secret variables. Store the
.p12 password (e.g. P12_PASSWORD) as a secret variable or in a variable group.
- (Recommended) Pin the Mac's host key. On the Mac:
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub and copy the SHA256:… value into Mac host key fingerprint.
Example
trigger: [main]
pool:
name: WindowsSelfHosted # self-hosted Windows agents on the Mac's network
variables:
- group: ios-signing # P12_PASSWORD, ASC_KEY_ID, ASC_ISSUER_ID
steps:
- task: MacConnectorIos@0
name: ios
inputs:
macConnection: 'build-mac'
project: 'src/MyApp/MyApp.csproj'
configuration: 'Release'
signingMode: 'secureFiles'
certSecureFile: 'distribution.p12'
certPassword: '$(P12_PASSWORD)'
profileSecureFile: 'MyApp_AppStore.mobileprovision'
buildNumber: '$(Build.BuildId)'
outputDirectory: '$(Build.ArtifactStagingDirectory)/ios'
includeDsym: true
uploadToTestFlight: true
ascKeyId: '$(ASC_KEY_ID)'
ascIssuerId: '$(ASC_ISSUER_ID)'
ascPrivateKeySecureFile: 'AuthKey_ABC123XYZ.p8'
- script: echo IPA is at $(ios.ipaPath)
- publish: '$(Build.ArtifactStagingDirectory)/ios'
artifact: ios
Android and iOS from the same Windows job:
- task: DownloadSecureFile@1
name: keystore
inputs: { secureFile: 'release.keystore' }
- script: >
dotnet publish src/MyApp/MyApp.csproj -f net9.0-android -c Release
-p:AndroidPackageFormat=aab -p:AndroidKeyStore=true
-p:AndroidSigningKeyStore=$(keystore.secureFilePath)
-p:AndroidSigningKeyAlias=$(KEY_ALIAS)
-p:AndroidSigningKeyPass=$(KEY_PASS) -p:AndroidSigningStorePass=$(STORE_PASS)
-o $(Build.ArtifactStagingDirectory)/android
displayName: Android (.aab) on Windows
- task: MacConnectorIos@0
displayName: iOS (.ipa) on the Mac
inputs:
macConnection: 'build-mac'
project: 'src/MyApp/MyApp.csproj'
certSecureFile: 'distribution.p12'
certPassword: '$(P12_PASSWORD)'
profileSecureFile: 'MyApp_AppStore.mobileprovision'
outputDirectory: '$(Build.ArtifactStagingDirectory)/ios'
| Input |
Default |
Notes |
macConnection |
— |
SSH service connection to the Mac. |
hostKeyFingerprint |
— |
SHA256:… of the Mac's SSH host key; the task refuses another key. |
project |
— |
The .csproj to publish. |
sourcesRoot |
$(Build.SourcesDirectory) |
Folder copied to the Mac; must contain the project and everything it references. |
configuration |
Release |
|
targetFramework |
from the project |
e.g. net9.0-ios. |
signingMode |
secureFiles |
secureFiles: .p12 + profile from Secure Files in a temporary keychain. mac: identities/profiles already on the Mac and the signing saved in the .csproj (VS 2022 / Mac Connector iOS Bundle Signing). |
certSecureFile, certPassword, profileSecureFile |
— |
secureFiles mode. |
macKeychainPassword |
— |
mac mode: unlocks the login keychain for codesign over SSH. |
codesignKey |
detected |
CodesignKey override. |
provisioningProfile |
project |
mac mode: CodesignProvision override (name or UUID). |
entitlements |
project |
CodesignEntitlements, project-relative. |
displayVersion, buildNumber |
project |
ApplicationDisplayVersion / ApplicationVersion. |
outputDirectory |
$(Build.ArtifactStagingDirectory) |
Where the .ipa / .dSYM.zip are saved. |
outputFileName |
Mac's name |
File name without extension. |
includeDsym |
false |
Also download the zipped dSYM. |
uploadToTestFlight, ascKeyId, ascIssuerId, ascPrivateKeySecureFile |
off |
App Store Connect team API key (App Manager or Admin). |
msbuildArguments |
— |
Extra dotnet publish arguments; quote values with spaces. |
syncExcludes |
bin, obj, .git, .vs, node_modules, artifacts, *.user |
One glob per line. |
remoteRoot |
~/.macconnector-ci |
Each run uses runs/<run> here; folders older than 2 days are removed automatically. |
cleanRemote |
true |
Delete this run's folder on the Mac afterwards. |
Output variables: ipaPath, dsymPath (reference them as $(<step name>.ipaPath)).
Notes
- Parallel jobs can share one Mac: every run has its own folder and keychain, and changes to the keychain search list are serialised. Builds still share the Mac's CPU.
- Provisioning profiles are installed in the Mac user's profile folder and stay there (same as installing them in Xcode). The certificate never touches the login keychain in
secureFiles mode.
- Cancelling a run stops
dotnet and its child processes on the Mac and runs the cleanup.
- Microsoft-hosted Windows agents can use the task only if the Mac's SSH port is reachable from the internet; self-hosted agents on the Mac's network are recommended.