DevOps - James Montemagno https://staging.montemagno.com/tag/devops/ https://staging.montemagno.com/content/images/2017/08/MonogramIcon_Orange_NoBuffer.png DevOps - James Montemagno https://staging.montemagno.com/tag/devops/ Hugo -- gohugo.io Tue, 13 Oct 2026 20:48:55 GMT 60 Azure DevOps Settings for Xamarin iOS 13 and Android 10 Apps https://staging.montemagno.com/azure-devops-settings-for-xamarin-ios-13-and-android-10-apps/ 5dd43e2784e2c7003870dfe2 Wed, 20 Nov 2019 20:12:00 GMT

Settings up continuous integration can be tricky when there are new versions coming out. Recently Visual Studio 2019 updated to support Xcode 11, iOS 13, Android 10, .NET Core 3, and C# 8. What a whirlwind of new updates that CI servers got all around the same time! This means that as you were updating your apps your hosted machines also got updated and probably broke your builds :(. My good friend Jonathan Peppers wrote an amazing tool called Boots that allows you to manually install dependencies and previews of Xamarin and Mono.

Boots task in Azure DevOps installing Mono 6.4.0

This is great, but it also means that your build takes a little bit longer to manually install items. Did you know that Azure DevOps has all of the latest bits installed on their hosted agents and even have simple scripts enabling you to decide what version of Xamarin and Mono to run? Here is what you need to know to build your apps in Azure DevOps with C# 8, iOS 13, and Android 10.

Use macOS 10.14

Be sure that you select the latest version of macOS to build your iOS and Android apps on. You can simply specify macOS-latest or macOS-10.14 in your Pipeline settings.

macOS-version selection in Azure DevOps

You can find what software is installed here.

Install .NET Core

This may sound funny to install .NET Core for a Xamarin build, but the latest reference assemblies and build system require it. You can find what version of .NET Core is compatible with Visual Studio for Mac on the docs site.

You can add the Use .NET Core task to install .NET Core 2.2.x or 3.0.x. Either work just fine.

.NET-Core version task in Azure DevOps

Set Xamarin & Mono Version

This next task is very important as it will tell the build agent what version of Xamarin and Mono to use when compiling the app. I like to define a variable with the version number in the format Major_Minor_Revision. For the latest we will use 6_4_0:

Variable in Azure DevOps specifying Mono 6.4.0

Then we will add a task to run a bash script to set the version of Xamarin. This is done with the following inline script:

sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $(MonoVersion)

Bash script setting the version of Xamarin to use

That is it! Now you are good to go to build your apps with C# 8, iOS 13, and Android 10!

More DevOps!

Looking for more DevOps? Checkout my Channel 9 series on DevOps for Mobile Developers where I walk you through everything you need to know about DevOps with my friend Abel.

]]>
Super Simple Git Tagging & Releases in Azure DevOps https://staging.montemagno.com/super-simple-git-tagging-releases-in-azure-devops/ 5c13e3d958056200bf4c25ae Mon, 21 Jan 2019 16:30:00 GMT I am going to be honest with all of you, I never really understood Git tags and releases inside of GitHub. In my old TFVC days I would just create a branch with the name of the release and call that my "tag" so I could always go back to it. What sparked my interest was seeing a bunch of popular projects that I was using combine tags with the GitHub releases. I started reading the documentation and still wasn't sold on it because I have a full CI/CD pipeline setup for all of my projects and I wasn't sure how this would fit in. Then the lightbulb went off when I saw Jon Dick implement an amazing tagging scheme that would fire off a build, compile a NuGet, and then release the artifacts to NuGet automatatically...

mindblown

Even though this was the coolest thing ever I didn't want to go changing all of my pipelines, but it did encourage me stop doing random branches for releases and streamline my tagging and releases when publishing NuGets. This is surprisingly easy to do with the new GitHub Release task. It is a very nice extension that allows you to create a tag, or re-use a tag, add a changelog file, specify release name, add artifacts, and a bunch more.

In my continuous delivery pipeline I have the following workflow:

Pipeline

My strategy here is to ensure that when I go to NuGet (beta) I create a pre-release tag and release and then when I go to full production I simply update that existing release/tag with updated information.

Uploading a Changelog

Traditionally I never uploaded anything to the drop folder except for the NuGet packages, but a nice thing with the the release task is that you can attach a changelog file (or manually enter it). Since I have a changelog file checked in to each of my repositories that I regularly update, I can just add it to the drop folder in my CI pipeline. In the Copy Files task I simply added:

**\bin\$(BuildConfiguration)\**
**\CHANGELOG.md

Adding a Pre-Release Tag & Release

After I release my pre-release package to NuGet, I want to create my very first Tag and Release. First step is to simply add the GitHub Release task:

Task

Now, it is time to fill in the information for the tag and release:

  • Select GitHub connection
  • Select GitHub repository
  • Action: Create
  • Target: $(Build.SourceVersion)
  • Tag Source: User Specified Tag (if you want to you can have it use an existing tag)
  • Tag: v$(Build.BuildNumber)
  • Release Title: v$(Build.BuildNumber)
  • Release note source: Release notes file
  • Release notes file path: $(System.DefaultWorkingDirectory)/**/CHANGELOG.md
  • Assets:
$(System.DefaultWorkingDirectory)/**/drop/beta-public/*.nupkg
  • Options: Pre-release & Add changelog

Editing a Release

Now, when I go into my final phase to publish my packages to stable on NuGet I want to modify the release I just created. You could optionally create a new release and different tag, but this makes no sense to me currently (leave comments below to let me know what you think).

You can simply add the same exact Task and instead of specifying Create for the Action specify Edit. You will fill in all of the same information except at the end:

  • Assets: Instead of beta-public folder, I change it to public
  • Replace existing assets
  • Uncheck pre-release

And just like that you will have beautiful releases automatically when you publich to NuGet in pre-release or stable:

Capture

]]>
Enhanced Mobile App Versioning in Azure DevOps (VSTS) with Mobile Tasks https://staging.montemagno.com/enhanced-mobile-app-versioning-in-azure-devops-vsts-with-mobile-tasks/ 5c39652e58056200bf4c25d0 Tue, 15 Jan 2019 22:30:00 GMT A little over a year ago, I introduced my Mobile App Tasks Extensions for iOS and Android into the Azure DevOps (VSTS) marketplace. For iOS and Android developers it made the tasks of versioning and adjusting package names a breeze. They were written completely in TypeScript with VS Code and of course are open source on GitHub. Since the initial release I have received overall positive feedback and a few feature requests to add new features. Over the last year I teamed up with my good friend Andrew Hoefling to add small features and optimizations, but finally this week we released version 1.0 with tons of great new features!

New

PList Transform

The first feature you will see is a brand new PList Transform Task. Andrew sent down this pull request and it is super slick. Basically just set any property name and value you want to set in your iOS plist file and you are good to go!

Unix Timestamp

When versioning apps I always had the assumption that developers wanted to manually configure version numbers. However, sometimes you want an auto incrementing number such as a timestamp. When versioning iOS and Android apps you now have the ability to select a custom version number or auto numbering with the Unix time in seconds. This matches App Center functionality, which is super cool :)

format

Misc Updates of Joy

Beyond that we fixed a few other items such as adding the iOS Bundle Identifier to the package name task, fixed issues when comments were in the Android Manifest, handled escaped paths, and updated to the latest packages.

Grab the Extension

You can grab the latest update of the Mobile App Tasks from the Visual Studio Marketplace right now!

Watch Me & Donovan

Last year my good friend Donovan Brown asked me to come on Visual Studio Toolbox to show off the awesome extension and talk Mobile DevOps. Check it out as I walk through the extensions:

How It Was Developed

If you want to see more on how it was developed be sure to check me out on Twitch where I live code. I recently did a full live stream where I added the unix timestamp feature to iOS and Android build tasks. You can watch the full video on YouTube right now!

]]>
Building Xamarin.iOS Apps in Azure DevOps (VSTS) with Hosted macOS Agents! https://staging.montemagno.com/building-xamarin-ios-apps-in-team-services-vsts-with-hosted-macos-agents/ 5a204fd19f3eff0022eb6594 Thu, 30 Nov 2017 20:38:16 GMT

Azure DevOps (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, Azure DevOps (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 Azure DevOps (VSTS) on Merge Conflict Episode 71.

Azure DevOps (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 Azure DevOps (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 Azure DevOps (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

Build with MSBuild (VS for Mac)

One little gotcha seems to be that if you are using new project structures or .NET Standard you will need to use MSBuild (this is the default now in VS for Mac anyways). So make sure you flip the switch under advanced:

BuildwithMSBuild

At this point you are ready to go, and just like that you are off to the races building your iOS apps inside of Azure DevOps (VSTS) on a hosted macOS agent!

]]>
Using Visual Studio Mobile Center with a Azure DevOps (VSTS) Code Repo https://staging.montemagno.com/vs-mobile-center-builds-with-vsts-repo/ 598df8f2c121b60019bf2fcb Wed, 12 Apr 2017 01:29:14 GMT

So, this is pretty awesome! Today, the Mobile Center team rolled out a huge update to Visual Studio Mobile Center enabling you to build your iOS and Android apps in the cloud from any GitHub, BitBucket, or Azure DevOps (VSTS) code repository! This is great because VSTS offers FREE unlimited private repos for your code with a git backend. Mobile Center offers up build, test, distribute, analytics, and backend services for any mobile app written in any language. It couldn’t be easier to get started, simply click the VSTS button and log in to authenticate and done!

tumblr_inline_oo9vnjxA8y1qzumo9_540

It is so simple to do that I walk you through it in just 4 minutes! Check it out:

]]>
Deploying an ASP.NET Core app to Linux on Azure App Service https://staging.montemagno.com/aspnet-core-azure-linux-app-service-deployment/ 598df8f2c121b60019bf2fd2 Tue, 28 Feb 2017 22:46:07 GMT You probably wouldn’t expect this blog post from me as I run away from building any web apps, but I have been messing around with ASP.NET Core inside of Visual Studio for Mac. I thought it would be really cool to take our default app for items and deploy it to an Azure Linux based App Service. Because… why not?!?! Also, I will make Hanselman proud.

So, first things first.. The backend.

My Items on ASP.NET Core

If you head over to your Visual Studio for Mac you will see a “Connected App” template. This outputs an iOS and Android app that can talk to a localhost ASP.NET Core application that runs on your macOS machine! Whoa Cool!. Now make sure you have the latest RC4 of .NET Core installed. It isn’t the one on the home page of .NET Core.. it is hidden in a GitHub readme: https://github.com/dotnet/core/blob/master/release-notes/rc4-download.md

If you just want the source code for the app to play around with you can grab it from my GitHub. Now, once we have the source code we can run the site and navigate to /api/item to retrieve the default lists of items:

Linux App Service

Looking good! Next up, Let’s create our Azure App Service that will run on Linux (in preview today). Head to your Azure Portal and hit New -> Web + Mobile + Web App on Linux (preview):

This will go through the standard setup process and bring you in to your standard app service settings. The first thing that we need to do is adjust our Docker Container. We want to select .NET Core v1.0 runtime stack and REALLY REALLY IMPORTANT to set the startup file. This file is the main DLL of our application. We will be uploading our files to the wwwroot.

Build

I decided to throw all of my code in Visual Studio Team Services (VSTS) and do some good DevOps work to make Donovan Brown proud. You could also just put your code on GitHub if you would like and VSTS will also build it. To actually build it, is crazy easy actually, just select ASP.NET Core (PREVIEW).

This literally does everything for you! I have disabled tests and I have my dotnet commands pointing to a subfolder, but that is about it:

Release

Now, let’s publish this thing. The build will give us a zip file to use and normally you would use Web Deploy and done… but that doesn’t work on Linux just yet… and Kudu… not yet.. and all the continuous git stuff… not yet… so let’s FTP the files! In the azure portal you can grab your FTPs user name and password that you will need.

There are 4 steps needed in the release definition:

  1. Stop App Service

  2. Extract Zip File

  3. Upload Files

  4. Start App Service

1, 2, and 4 are easy with minimal config, but #3 you must specify the remote directory of /site/wwwroot

Whoa!! we did it!!

Fun fact… Preview inside of VSTS and the Azure portal in this blog post alone are cased 3 different ways :)

]]>
Version Bumping iOS & Android apps in Azure DevOps (VSTS) https://staging.montemagno.com/version-bumping-ios-and-android-apps-in-visual-studio-te/ 598df8f2c121b60019bf2fd4 Wed, 22 Feb 2017 17:46:37 GMT I love Continuous Integration and Deployment for mobile applications and have given several talks on it in the past. It streamlines your entire development process and makes it drop dead simple to simply commit code and have everything you don’t want to do manually be taken care of for you. This means build, test, bump versions, and ship off to testers with integrations like HockeyApp. Notice I mention “bump versions”, which is actually really important. Every build should be assigned a unique number so developers and testers know exactly what is out there. There is nothing worse then seeing 1.0 on every single build and it makes it impossible to ship out to the app store. Today, I will walk you through bumping version numbers on your iOS and Android apps. 

If you are looking to get your Xamarin apps setup in VSTS then checkout my blogs for Android and iOS that offer a full walk through. This blog will work with any iOS or Android app regardless of how you build it :)

ALM Build & Release Tools

There unfortunately is no out of the box support from what I have seen to actually bump versions, but we can leverage a marketplace extension from Colin called ALM Build & Release, specifically the “Version Assemblies” step.

Android Version Bumping

In my Android manifest my name and code look like this:

android:versionCode="1" android:versionName="1.0.0"

These are important, as we will use a regex to update them.

We will want to add the “Version Assemblies” task TWICE, once for the version name and once for the version code.

Once added, we will bump the name.

First insert the following (with examples):

  • Source Path: src/MobileApps/MyDriving/MyDriving.Android/Properties
  • File Pattern: AndroidManifest.xml
  • Build Regex Pattern: (?:\d+.\d+.\d+.)(\d+)

Under Advanced:

  • Build Regex Group Index: 0

  • Regex Replace Pattern: versionName=“\d+.\d+.\d+

  • Prefix for Replacements: versionName=”

What this will do is update the version name to the Build number format found under “General”, which mine is set to 1.0.0$(rev:.r)

Now for the next one, which is the version code:

  • Source Path: src/MobileApps/MyDriving/MyDriving.Android/Properties
  • File Pattern: AndroidManifest.xml
  • Build Regex Pattern: (?:\d+.\d+.\d+.)(\d+)

Under Advanced:

  • Build Regex Group Index: 1

  • Regex Replace Pattern: versionCode=“\d+

  • Prefix for Replacements: versionCode\

And just like that you are good to go. This will simply update it with the current version revision :)

iOS Version Bumping

This one is a bit trickier and requires some specific things set in the Info.plist. We will need to ensure that the following are set to these very very specific version numbers in the actual Info.plist:

  • CFBundleShortVersionString: 1.0.1

  • CFBundleVersion: 1.1.1 

Don’t ask me why, just trust me!

Under General I have set my build number format to 1.2.$(rev:.r):

I think we just happened to be on 1.2 which is why it is like this, your mileage may vary here. Now we will add the Version Assemblies task TWICE, just like we did for Android.

Let’s first bump the CFBundleShortVersionString:

  • Source Path: src/MobileApps/MyDriving/MyDriving.iOS
  • File Pattern: /Info.plist
  • Build Regex Pattern: (?:\d+.\d+.)(\d+)

Under Advanced:

  • Build Regex Group Index: 1

  • Regex Replace Pattern: 1.0.\d+

  • Prefix for Replacements: 1.2.

That will bump it to 1.2.BuildNumber. 

Let’s then bump the CFBundleVersion:

  • Source Path: src/MobileApps/MyDriving/MyDriving.iOS
  • File Pattern: /Info.plist
  • Build Regex Pattern: (?:\d+.\d+.)(\d+)

Under Advanced:

  • Build Regex Group Index: 1

  • Regex Replace Pattern: 1.1.\d+

  • Prefix for Replacements: 1.2.

As you can see I have to execute these in a specific order to not bump versions differently. It is tricky, but so are regex. And there you have it, bumping versions for both iOS and Android inside of Visual Studio Team Services.

]]>