A migrated app that builds only on one laptop is not migrated. It is a risk with a new framework version. Most Xamarin apps we read were released from a Mac that nobody can describe: a keystore in a home directory, a distribution certificate in a login keychain, a provisioning profile that Xcode downloaded once.
This post covers the signing and CI setup for a .NET MAUI app so that a clean agent can produce a store-ready build. Exact task names and versions change. Check them against your CI provider's current documentation before copying anything.
Step 1: inventory the signing state before you touch the pipeline
Write down, for each platform, what exists and who holds it.
- Android: the upload keystore file, its alias, both passwords, and whether the app uses Play App Signing. If Play App Signing is on, you hold an upload key, and Google can help reset it. If it is off, the keystore is the app's identity. Losing it is permanent.
- iOS: the distribution certificate and its private key, the App Store provisioning profile, the bundle identifier, and the Apple Developer team that owns them. A certificate without its private key is useless on a new machine.
If any item is missing, find out now. This is the most common reason a migration stalls in week one.
Step 2: Android signing on a clean agent
Keep the keystore out of the repository. Store it as a base64 secret in your CI secret store, with the alias and passwords as separate secrets. In the pipeline, decode it to a temporary file on the agent.
echo "$ANDROID_KEYSTORE_BASE64" | base64 --decode > $RUNNER_TEMP/upload.keystore
Then publish an app bundle and pass the signing properties on the command line, not in the .csproj.
dotnet publish -f net8.0-android -c Release \
-p:AndroidPackageFormat=aab \
-p:AndroidKeyStore=true \
-p:AndroidSigningKeyStore=$RUNNER_TEMP/upload.keystore \
-p:AndroidSigningKeyAlias=$KEY_ALIAS \
-p:AndroidSigningKeyPass=env:KEY_PASS \
-p:AndroidSigningStorePass=env:STORE_PASS
Use the target framework your project actually declares. Two checks catch most failures: the version code must increase on every upload, so derive it from the CI build number, and the merged manifest must carry the target API level Play currently requires.
Step 3: iOS signing on a clean agent
The iOS build needs a Mac agent with the Xcode version your MAUI workload supports. That pairing is the first thing to verify. See our post on the iOS build after Xcode moves past Xamarin for the failure mode.
The reliable pattern is to avoid the login keychain entirely:
- Create a temporary keychain on the agent and unlock it.
- Import the distribution certificate (a
.p12file from a secret) into it, with its password. - Install the provisioning profile into
~/Library/MobileDevice/Provisioning Profiles. - Build with explicit signing settings.
- Delete the temporary keychain at the end of the job, even when the build fails.
security create-keychain -p "$KC_PASS" build.keychain
security unlock-keychain -p "$KC_PASS" build.keychain
security import cert.p12 -k build.keychain -P "$P12_PASS" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k "$KC_PASS" build.keychain
dotnet publish -f net8.0-ios -c Release \
-p:ArchiveOnBuild=true \
-p:CodesignKey="Apple Distribution: Your Company (TEAMID)" \
-p:CodesignProvision="Your App Store Profile Name"
The profile name must match the name in the Apple Developer portal exactly. The bundle identifier in Info.plist must match the profile's App ID.
Step 4: failures you should expect
- No signing certificate found. The certificate was imported without its private key, or into a keychain that is locked or not in the search list.
- Provisioning profile does not include the certificate. The profile was generated against a different distribution certificate. Regenerate it in the portal and replace the secret.
- Profile expired. Profiles last a year. Put the expiry date in the team calendar. Do not rely on remembering.
- Entitlements mismatch. Push notifications, associated domains or app groups are in the app but not enabled on the App ID.
- Upload rejected for duplicate version code or build number. Derive both from the pipeline, never by hand.
Step 5: finish with a dry run
Before you trust the pipeline, run it from a fresh agent with no cached state, then upload to an internal Play track and TestFlight. If both succeed without anyone touching a laptop, the pipeline is real. Document where each secret lives and who can rotate it, so the next engineer does not rediscover this.
What we would not do
Do not commit the keystore or .p12 to the repository for convenience, even a private one. Do not share one personal Apple ID login with CI. Use an App Store Connect API key instead.
Send us the repo
If your pipeline depends on a machine nobody can reproduce, send us the repo. We will read the build and signing setup and return a written plan.