Using TFS 2015 with Xamarin (Walkthrough)

How to do Continuous Integration with a Xamarin project and TFS 2015

PDF for offline use
Related Samples:
Related Links:

Let us know how you feel about this

Translation Quality


0/250

last updated: 2017-04

This document walks through the process of creating a Continuous Integration (CI) workflow that builds a Xamarin app using a self-hosted Team Foundation Server. It covers taking an existing solution, attaching it to a TFS Team Project, and automating the build and unit testing of checked-in source code.

Overview

As discussed in the document Introduction to CI, Continuous Integration (CI) is a software development practice where members of a team integrate their work frequently. Each integration is verified by an automated build (including running tests) to detect integration errors as quickly as possible.

Team Foundation Server 2015 (TFS 2015) is an Application Lifecycle Management (ALM) product used to support development practices. It provides the tools required to effectively manage software development projects throughout their complete lifecycle.

For Xamarin projects, you can use VSTS and TFS either separately or together. With VSTS by itself, you create build definitions for each individual Xamarin platform for which you have a license. With TFS 2015, you can use any edition including TFS Express. For instructions on setting up a local TFS machine, see Configuring TFS 2015 for Xamarin.

In this section we'll now walk through using a configured TFS host with a Xamarin project:

  • Preparing an existing cross-platform Xamarin project for TFS.
  • Creating a new TFS Team Project and attaching the Xamarin project.
  • Adding unit testing.
  • Creating a TFS build definition to automate the build and running tests.
  • Checking-in code and testing our build definition.
  • Working with TFS and Xamarin Studio for Mac.

Before beginning this walkthrough, make sure you've completed the requirements described on Configuring TFS 2015 for Xamarin topic. This includes making sure that the Android SDK and NDK are installed on the TFS machine in an accessible location, which is described in Configuring the TFS 2015 computer to Build Android Apps

Walkthrough

For this walkthrough we’ll be using the simple TaskyPortable cross-platform sample app, which tracks todo/task items. It illustrates proper app architecture layering and uses a common code base for the Business Layer (BL), Data Access Layer (DAL), and Data Layer (DL) layers. It separates out the User Interface (UI) and Application Layer (AL) into the appropriate device-apps.

TaskyPortable is part of the greater Mobile Samples repository. Click Download as ZIP on the repository page, then extract the ZIP contents to a suitable location on your development machine. This collection contains many samples demonstrating code sharing between Android, iOS, and Windows projects.

You'll find the TaskyPortable solution in the TaskyPortable folder. (Note that TaskyPortable is very similar to the Tasky sample that is also in the collection, but implements all its shared code in a portable class library (PCL)).

Open the TaskyPortable solution now in Visual Studio so you can proceed with the following sections of this walkthrough:

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.