DEV Community

Victor Hugo Garcia
Victor Hugo Garcia

Posted on • Edited on

Azure DevOps for .NET MAUI using YML

NET Multi-platform App UI (.NET MAUI) is a cross-platform framework for creating native mobile and desktop apps with C# and XAML. Using .NET MAUI, you can develop apps that can run on Android, iOS, macOS, and Windows from a single shared code-base. In these post series, I will show you how to implement Continuous Integration in your .NET MAUI app using the Microsoft Azure DevOps with YML in a multi-environment.


Disclaimer

The steps below represent an approach I follow for my projects due to they accommodate for my requirements. You are free to update the logic and YML files to fit your needs on each project. Also, in an effort to demo the multi-environment, I am using Firebase Analytics services.


Getting Started

Shared

  • In the Azure Pipelines -> Library upload the Android KeyStore file, the Apple .p12 certificate & provisioning profile files and the Google firebase config files if you are using this service.

Make sure the Google firebase files are renamed using the following sample:
Image description

  • Then create a variable group called: "App Configuration" within the Library, this variable group will contain the configuration keys for the Android and iOS build and we use them because it is the securest way to store the sensitive data.
Variable Value
app-build-configuration Release
app-check-dependencies true
app-id-android com.company.appname
app-id-ios com.company.appname
app-path-contents PROJECT_PATH/bin
app-path-project PROJECT_PATH/project.csproj
app-path-root PROJECT_PATH
app-target-framework-android .net7.0-android
app-target-framework-ios .net7.0-ios
apple-certificate-name CERTIFICATE_NAME.p12
apple-certificate-password ******
apple-provisioning-profile-name PROFILE_NAME.mobileprovision
dotnet-version 7.0.x
android-signing-key-password ******
android-keystore-alias ALIAS
android-keystore-name FILE.keystore
android-keystore-password ******

iOS

  • Create a new file azure-pipelines-ios.yml in your code repository at any path you prefer.

Android

  • Create a new file azure-pipelines-android.yml in your code repository at any path you prefer.

Basically, the pipelines will always trigger automatically pointing to the staging environment when a versioning tag is added to a branch, however, you can run the pipeline manually and set the environment pointing to production, so it generates a new version of the app. Just, don't forget to set the version tag before trigger the pipeline manually.

What About Distribution?

I'm working in a post to share how to distribute the application through different channels. I hope to have it ready soon.

Conclusion

There are tons of combinations and customizations for the YML and each project may have its own set of rules for CI. Take this just as an example or base and improve it, please!

I hope this helps others to create their own pipelines for .NET MAUI.

Top comments (6)

Collapse
 
lomeshnparmar profile image
lomeshnparmar • Edited

@vhugogarcia do you have any updates for how to release (CD) for generated .apk or .ipa? Also want to know how can we release to VS App Center?

Collapse
 
vhugogarcia profile image
Victor Hugo Garcia

Hello @lomeshnparmar ,

Thanks for looking into. I have been very busy, however, you can certainly refer to these 2 good guides from our friend Damien:

I followed those guides to successfully deploy my apps to the correct channels.

About VS App Center, I don't have experience, however, I will research about it.

Collapse
 
bcr profile image
B.R.

There is an AppCenter CLI, this would probably be the most useful. There are also "classic" tasks for AppCenter as well.

Collapse
 
andrewgene profile image
Andrew Goodwin

Thank you so much for the download of the keystore file. We missed that step and COULD NOT get it to work.

Collapse
 
rajkumarkvvsn profile image
Rajkumar

@vhugogarcia

Thanks for the great post. one question, this yml schema support .Net Android and .Net iOS?

Collapse
 
vhugogarcia profile image
Victor Hugo Garcia

Hello @rajkumarkvvsn ,

This yml only supports .NET MAUI apps.