Installing Xamarin Components on MacOS13 for MSBuild in Azure Pipelines
In this guide, we’ll explore how to install necessary components from Apple and Google (for Android) onto a macOS build
agent running version 13. This process is essential when building cross-platform C# projects using Xamarin that require
iOS & Android environments. We will cover the steps needed for both Mono Framework, required by Microsoft Build
Tools (msbuild
), as well as specific components like Xamarin.Android
and build bindings (e.g.,
/Library/Frameworks/Mono.framework
).
Overview of Issues with macOS13 Image
Upon transitioning to MacOS 13, you might encounter missing Xamarin libraries such as Mono Framework required for the MSBuild process in Azure Pipelines:
The specified language targets 'monoandroid' is missing. Ensure correct tooling installed... /Library/Frameworks/Mono.framework/Versions/*version*/lib/mono/xbuild/Xamarin/Android/Xamarin.Android.Bindings.targets*missing*. Make sure Xamarin SDK tools are present, or install the packages manually as discussed here: <URL>
This error stems from an updated macOS13 image where certain build components may not be installed by default anymore due to changes in Apple’s tooling and licens0ns.
Installation Steps for MacosXamarin Framework (Mono)
Follow these steps using the command line on your agent:
VERSION=6.12.0.182 # Change this with latest Mono version you need to install
MONO_FOLDER_NAME=$(echo $VERSION | cut -d. -f 1,2)
PKG_URL="https://download.mono-project.com/archive/$MONO_FOLDER_NAME/macos-10-universal/MonoFramework-MDK-$VERSION.xamarin.universal.pkg" # Prepare the package URL dynamically based on Mono version
PKG_NAME=$(basename "$PKG_URL") # Extract just the filename from it for installation
curl -4fsLo "${PKG_NAME}" ${PKG_URL} # Download Mesa framework using curl command-line tool (not 'wget')
sudo installer -pkg "${PKG_NAME}" -target / # Installing Mono Framework package on your system with sudo privileges. Note: You may need to enter a password here if prompted by the OS for root access permission during installation, which is required when installing software packages globally using `sudo`.
After successful installations of these components you might have resolved issues related to missing language targets in MSBuild process on Azure Pipelines.
Setting Up Xamarin Components (Android and iOS) Manually
Besides Mono Framework, specific Android or bindings for libraries like Xamarin.Android
may require additional setup:
# For installing the necessary SDKs as mentioned in #7635's linked GitHub issue comment - please adjust with actual sdk versions needed and their corresponding sources/links here (e.g., Xamarin Android).
VERSION=androidsdkversionhere # Specify your android development environment version number for download
PKG_URL="https://download-sourceurlforxamarinandroid"
curl -4fsLo "AndroidSDK-$VERSION-darwin.zip" ${PKG_URL} # Download Android SDK package using curl command line tool (not 'wget') as shown above, replace with actual URL for your specific environment version and source link of the androidsdk here
unzip "AndroidSDK-$VERSION-darwin.zip", -d /Library/Frameworks/#MONOFOLDER_NAME # Unpack SDK files to a known directory (e.g., into Mono framework's installation path) for easy accessibility by your build agent and make sure you have 'unzipping software available on the MacOS
If these components are part of Google Components, they will likely be included in Xcode or Android Studio bundle
provided with macOS13. If not present, follow Apple’s guidel Dragging them into /Library/Frameworks/
as instructed by
#7635 comment can help install Xamarin Bindings for specific libraries (e.g., binders).
Azure Pipelines Configuration Adjustment
For MSBuild: Add the following additional steps to your build script or YAML definition in Build pipeline of azure devops, after restoring NuGet packages and before executing msbuild command - make sure you’ve included these lines within scripts/yaml section. This ensures Mono Framework is available for
msbuild
at runtime
export PATH=$PATH:/Library/Frameworks/$MONO_FOLDER_NAME:$HOME/.nuget # Add to your build agent environment variables
echo "Set path variable" >> ~/.bashrc # Appending this line into the .bashrc file. This command will run in bash shell on MACOS when you SSH onto machine from where MSBuild is triggered, so every time that a new terminal session starts up it'll have `$MONO_FOLDER` set
These steps should resolve most of your build issues related to Xamarin components installation and setup for Macos13 in
Azure Pipelines. Please ensure you replace placeholders like androidsdkversionhere
, the package source links, etc.,
with actual versions or sources applicable on Microsoft Build tools specific library/framework installations required by
Xcode (iOS).
Please share your feedback if this worked out for you too!