Xamarin.Forms - Implement CI/CD Using App Center

In this article, you will learn how to implement Continuous Integration(CI) and Continuous Deployment (CD) using App Center in Xamarin.Forms mobile app.

Introduction

 
Xamarin.Forms code runs on multiple platforms - each of which has its own filesystem. This means that reading and writing files is most easily done using the native file APIs on each platform. Alternatively, embedded resources are a simpler solution to distribute data files with an app.
 

App Center

 
Xamarin.Forms - Implement CI/CD Using App Center
 
App Center has multiple services that are most commonly used by mobile developers, where multiple services act as a single integrated product. With the use of a single integrated product, you can build, test, distribute, and monitor your mobile apps, and also implement push notifications.
 

Support Platforms

  • Android
  • iOS
  • React Native
  • UWP
  • Xamarin
  • macOS
  • Cordova
Xamarin.Forms - Implement CI/CD Using App Center

App Center Services

  1. Build
  2. Diagnostics (Formerly Crashes)
  3. Test
  4. Analytics
  5. Distribute
  6. Push Notifications
Xamarin.Forms - Implement CI/CD Using App Center
 
CI - Continuous integration is the process of merging all developers' work into a single main repository.
 
CD - Continuous delivery is a process of automatically building and deploying your Xamarin apps to testers or end-users.
 
More info
https://docs.microsoft.com/en-us/appcenter/build/
 
Prerequisites
  • Visual Studio 2017 or later (Windows or Mac)
  • App Center Account
  • Any Git Repository

Create an app in the App Center (Android)

 
In this step, create an app in the App Center. Go to the following link. Now, sign in using your preferred account.
 
https://appcenter.ms/
 
Xamarin.Forms - Implement CI/CD Using App Center
 
Add New app
 
In this step, give your app name (Ex: MyApp). Select OS (Android) and Platform (Xamarin). Click Add new app.
 
Xamarin.Forms - Implement CI/CD Using App Center
 
Connect to Repository
 
In this step connecting your source repository, you can select which Repository you used. I'm going to select Azure DevOps.
 
Xamarin.Forms - Implement CI/CD Using App Center
 
Now select your repository and working branch. I used master branch.
 
Xamarin.Forms - Implement CI/CD Using App Center
 
Build Configuration
 
In this step, I'm going to configure and build environment. After selecting git repository branches, you will see this window. Now, you can click the setting icon in your branch.
 
Xamarin.Forms - Implement CI/CD Using App Center
 
Build
 
In this section, you configure your app build details.
 
Configuration = Release
SDK version = select Stable sdk version
 
Build frequency = build this branch on every push (once you push code your remote repository it will automatically build).
 
Xamarin.Forms - Implement CI/CD Using App Center
 
Environment
 
In this section, if your app has an environment variable, you can configure here.
 
Sign builds
 
In this section, configure signing details. Upload your Keystore file here. Check the following link to get Keystore file.
https://docs.microsoft.com/en-us/xamarin/android/deploy-test/signing/keystore-signature?tabs=macos
 
Set Keystore password here.
 
Xamarin.Forms - Implement CI/CD Using App Center
 
Distribute Builds
 
In this step, release your app to Store or Groups, I selected groups (once my build is successful, the apk will be sent to the selected group).
 
Now, Save & Build.
 
Xamarin.Forms - Implement CI/CD Using App Center
 
Done. You can commit your code and it will automatically build and distribute your respective group or store.
 
Xamarin.Forms - Implement CI/CD Using App Center
 
Xamarin.Forms - Implement CI/CD Using App Center
 
I hope you have understood how to implement Continuous Integration (CI) and Deployment (CD) using App Center in Xamarin.Forms mobile app.
 
Thanks for reading. Please share your comments and feedback. Happy Coding :)