How to Build Xamarin iOS Packages in Azure DevOps
Tags: devops, xamain, cicd
Published: 2023-03-11 16:30:23

---
title: How to Build Xamarin iOS Packages in Azure DevOps
published: true
date: 2023-13-11 16:45:14 UTC
tags: DevOps, Xamain, CICD
canonical_url: https://blog.bajonczak.com/how-to-build-xamarin-ios-pakages-in-azure-devops/ 
---

 ![How to Build Xamarin iOS Packages in Azure DevOps](https://images.unsplash.com/photo-1569144157591-f9a369ed0e6d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMTc3M3wwfDF8c2VhcmNofDF8fGlvc3xlbnwwfHx8fDE2NzE4MjY4NTg&ixlib=rb-4.0.3&q=80&w=2000)

DevOps is not only a buzzword, DevOps is a toolkit from Microsoft called Azure DevOps. This tool is a Sourcecode management tool, combined with a nice ticket system that can be used to manage projects and also deliver complete packages automatically.

So in this article, I will show you how I generate an App-File for an ios system like an iPhone with Azure DevOps.

#Requirements

To generate signed Packages for the iOS Packages you need a paid developer account from Apple. You can get one from [developer.apple.com](https://developer.apple.com/). Now you will get the following information

- The p12 certificate (with password)
- The provisioning profile

#Storing secure in Azure DevOps

The next important thing is how to store the file securely to get access during the build pipeline. For this AzureDevops has the option to store secure files. This is a separate store that will be available to the desired pipeline. These files are not always accessible to everyone, only to those that are allowed to accessing them.

![How to Build Xamarin iOS Packages in Azure DevOps](https://blog.bajonczak.com/content/images/2022/12/image-14.png)

After you have uploaded the provisioning file and the certificate you must next define the required variables.  So let's switch to the tab "Variable groups" and create a new group.  Let's call it "iosTest".

In this, we will define the following variables

![How to Build Xamarin iOS Packages in Azure DevOps](https://blog.bajonczak.com/content/images/2022/12/image-15.png)

The **AppleCertificate-FileName** contains the filename of the certificate stored in the secured file location. It's just a reference to this file nothing more. News you must store the password for this certificate into the variable **AppleCertificate-Password**. Finally, you need to store the filename of the provisioning file we call this variable **ProvisioningProfile-FilenName** , this will set only the reference to the file in the secure files-Tab.

#Create the Pipeline

I will step over how to create an empty pipeline. So I will share with you my yaml Pipeline script that I use to generate a signed IPA - package.

{% embed https://gist.github.com/SBajonczak/2b5715f2206aa6270c743b5f2ff8793b.js %}

At the top, we define that it will trigger only on the branch release\_candidate, so when you push your changes to this branch, it will start to run. The next definition is the used virtual Image to build on. It is important that it is set to macos-latest because this defines that all commands in our build will be run on an macOS runtime.

After that, we will reference our variable group called **iosTest**.  Now the following part defines the steps that are required to build our package. First of all, there are the steps, that will download the secured files from the secure file store in azure DevOps. After that, we install our certificate on the build agent and also the provisioning profile.

After that, it will restore the required NuGet packages and at the next step, it will start the main build for our package.  This will build the project with the given provisioning profile and the certificate. The build process can find them in the local key store because they were already installed before on this system.

Don't worry this image will be later destroyed so you must not have any worries about the security of your keys.

After the compilation is finished we will copy the IPA-File into the artifact store and upload them.

That's the complete process.

#Test the build definition

We can now execute the pipeline and after a while, you will get prompted with the green check.

![How to Build Xamarin iOS Packages in Azure DevOps](https://blog.bajonczak.com/content/images/2022/12/image-16.png)

> At first, I got some errors calling "The BaseOutputPath/OutputPath property is not set for project..." to fix this, I must open up the .csproj file and set the OutputPath-Property to a folder.

![How to Build Xamarin iOS Packages in Azure DevOps](https://blog.bajonczak.com/content/images/2022/12/image-17.png)

So you see that one artifact was published if you look into your artifacts you will see then your IPA-file

![How to Build Xamarin iOS Packages in Azure DevOps](https://blog.bajonczak.com/content/images/2022/12/image-18.png)

#Conclusion

With Azure DevOps, you have a nice Build tool that can build almost every runtime, also ios apps. With the option to build an ios App, you get the ability to create a CI/CD Pipeline that will automatically generate a new App-Version on every completed feature.