Many Xamarin developers take advantage of Azure DevOps or Visual Studio App Center to build and release their mobile applications. Each environment has its own installation of Mono, Xamarin, and everything you would need to build your Xamarin project.
However, each offering has some drawbacks:
- Azure DevOps currently has a single, fixed installation of Mono and Xamarin.
- App Center has a dropdown for selecting a specific version of Xamarin, but not always the latest release.
In both cases, developers will have to wait for updates to make it Azure DevOps or App Center. The latest Xamarin builds don’t currently arrive the same day as they are on the Visual Studio release channels, and there is not a way to install preview builds of Xamarin.
Introducing Boots
Internally we use a tool that can install specific builds of Mono, Xamarin, etc. on CI systems. It has been extremely valuable to pin builds to a specific version of Mono, Xamarin.Android, and Xamarin.iOS. We wanted all Xamarin developers to be able to do this, and so Boots was born.
Boots is a .NET Global Tool for installing .vsix or .pkg files. To use it:
dotnet tool install --global boots boots https://url/to/your/package
Boots currently supports Windows & Mac OSX, therefore:
- On Windows – assumes the file is a
.vsix
and installs it into all instances of Visual Studio viaVSIXInstaller.exe
. - On Mac OSX – assumes the file is a
.pkg
and installs it
So for example, to install Mono, Xamarin.Android, and Xamarin.iOS on Mac OSX:
boots https://download.mono-project.com/archive/6.0.0/macos-10-universal/MonoFramework-MDK-6.0.0.313.macos10.xamarin.universal.pkg boots https://aka.ms/xamarin-android-commercial-d16-2-macos boots https://bosstoragemirror.blob.core.windows.net/wrench/jenkins/xcode10.3/72cb587a39c12dfaa20cd5a0b1eb60a908ff88a6/1/package/xamarin.ios-12.14.0.113.pkg
Or install Xamarin.Android on Windows:
boots https://aka.ms/xamarin-android-commercial-d16-2-windows
Unfortunately, finding URLs for each of these builds is in a different place for each product.
URLs sourced from:
Azure DevOps
On Azure DevOps, simply add this YAML to your existing build definition:
variables: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true steps: - script: | dotnet tool install --global boots boots https://aka.ms/xamarin-android-commercial-d16-2-windows
DOTNET_SKIP_FIRST_TIME_EXPERIENCE
is optional, but will speed up the first dotnet
command.
To make things even simpler, we’ve published a Boots Extension from the VS Marketplace. This makes it easy to use from the build definition UI as well as from YAML:
steps: - task: Boots@1 displayName: Install Xamarin.Android inputs: uri: https://aka.ms/xamarin-android-commercial-d16-2-windows
App Center
App Center currently has an option to run a script during different points in your app’s build process. For example, placing a appcenter-post-clone.sh
in the same directory as your project can install a newer Mono and Xamarin.Android than currently available:
#!/usr/bin/env bash # App Center custom build scripts: https://aka.ms/docs/build/custom/scripts export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true dotnet tool install --global boots # Workaround instead of restarting shell # see: https://github.com/dotnet/cli/issues/9114#issuecomment-494226139 export PATH="$PATH:~/.dotnet/tools" export DOTNET_ROOT="$(dirname "$(readlink "$(command -v dotnet)")")" boots https://download.mono-project.com/archive/6.0.0/macos-10-universal/MonoFramework-MDK-6.0.0.313.macos10.xamarin.universal.pkg boots https://aka.ms/xamarin-android-commercial-d16-2-macos
See the App Center docs for further detail about custom build scripts.
Boots with Cake
You can use Boots
from a Cake script:
#addin nuget:?package=Cake.Boots Task("Boots") .Does(async () => { var platform = IsRunningOnWindows() ? "windows" : "macos"; await Boots ($"https://aka.ms/xamarin-android-commercial-d16-2-{platform}"); });
This will be helpful if you are already using Cake, and it gives you the flexibility to write custom build logic in C#!
Other CI Systems
Boots has been tested, and appears to work fine on:
Any build environment that can be configured to run .NET Core 2.1, can run Boots . If you have success on other CI systems, let us know!
I am trying to use this tool on Azure DevOps. But when I added it to my build definition, it seems like it is running forever on the install Xamarin.Android task. I am wondering how long does it normally take to get the installation done on Azure DevOps? Thanks in advance.
I’m guessing this is running on Windows? Unfortunately installing a vsix file takes some time. Can you file an issue with details here? https://github.com/jonathanpeppers/boots/issues
Maybe the main thing that we need is some indication of progress.