James Montemagno
James Montemagno

Live, Love, Bike, and Code.

Tags


Twitter


James Montemagno

Building Xamarin.iOS Apps in Team Services (VSTS) with Hosted macOS Agents!

James MontemagnoJames Montemagno

Visual Studio Team Services (VSTS) is quickly becoming one of my favorite products that Microsoft creates for developers. It helps any developer writing apps in any language build, test, and deploy their applications. On top of that it has free unlimited private Git repos, work item tracking and kanban board, test, release management, and so much more! What is cool is you can use some of it or all of it, up to you. So if you have your code in GitHub, no problem, want to use Trello, no problem, because they all work great together.

IQsRzovW

Since I am a cross platform developer, VSTS is awesome because I can build any of my iOS, Android, Windows, and ASP.NET backends all in one place. On top of that I can do complete release management straight to AppCenter Test/Distribute, Azure, or directly into the App Store. You can hear about my love and passion for VSTS on Merge Conflict Episode 71.

VSTS has always offered hosted Windows VMs for use and recently Linux VMs that could build apps in the "cloud", which is pretty awesome. This is nice becuase all of the tooling is installed and ready to go on demand. There was always one operating system missing, which was macOS... which is required for iOS and macOS development. This wasn't too bad because you can actually download the VSTS build agent on your own macOS machine and point VSTS to it. This is what I normally like to do, but it is also conveinent to run stuff in the cloud, which is why I am excited that they are now offering a hosted macOS agent! It is super easy to use and has some nice scripts installed for Xamarin developers.

Setting up an iOS CI Build

It couldn't be easier to get started with VSTS for Xamarin.iOS. In fact there is a pre-built template with everything setup that you need.

Xamarin-Templates

Hosted macOS Agent

Once the build is setup it is easy to use the hosted macOS agent. Under Process tap on the Agent and hosted macOS will show up!

HostedMacOS

At this point you are almost ready to go :)

Configuring Xamarin Versions

Here is a quick tip for selecting the version of Xamarin to use at build time on a hosted macOS agent. This is important because at the time of writing this it seems like the default Xamarin and default Xcode are not compatible, but it is when you specify Stable. To do this, the VSTS team has some scripts on the hosted machines that you can run with the built in Command Line task:

CommandLine

For the tool simply specify:

/usr/local/opt/vsts/scripts/select-xamarin-sdk.sh

For the argument specify:
Stable

And just like that you are off to the races building your iOS apps inside of VSTS on a hosted macOS agent!

Live, Love, Bike, and Code

Comments