Configuring Team Foundation Server for Xamarin
Step by step guide to required settings and configurations
Let us know how you feel about this
last updated: 2015-11
This guide will cover the settings and configurations necessary to use a self-hosted Team Foundation Server (TFS) with Xamarin for the Continuous Integration (CI) of mobile apps.
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.
Microsoft’s Visual Studio Team Services (VSTS) and Team Foundation Server (TFS) are popular Application Lifecycle Management (ALM) products used to support development practices. Both provide 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, you can use any edition including TFS Express, and we'll cover the steps to configure TFS here:
- Setting the required user rights.
- Connecting to TFS from Windows and Mac developers’ machines.
- Configuring the TFS machine to build Xamarin apps for Android and Windows.
- Connecting the TFS machine to a Mac build host to build Xamarin.iOS projects.
This configuration will also allow the TFS machine to be the build server for team projects hosted on VSTS. Details for how to make this connection are found on Deploy and configure a build server (MSDN).
The following diagram shows the layout and connections between hardware and software that we will be installing and configuring in this guide:
This configuration will support:
- iOS Debug/Build – Building and testing of iOS apps in Visual Studio from a Windows machine.
- Check In/Out – Allows developers in Visual Studio on Windows or Xamarin Studio on a Mac to check source code in and out of version control.
- Auto Build/Unit Testing – Provides automatic mobile app builds and running of unit tests on check in of new or modified source code to version control.
- Visual Studio with Xamarin (Windows only) – Install Visual Studio 2013 Professional or Ultimate, or any edition of Visual Studio 2015 or 2017. Configure Visual Studio with Xamarin for intended platform targets. See the Xamarin Installation Guide. Note that with Visual Studio 2015 and 2017, you can install Xamarin as part of Visual Studio setup.
- Xamarin Studio (Mac only) – Install Xamarin Studio, Xamarin.Android, and Xamarin.iOS.
Team Foundation Server Machine
- Team Foundation Server – Install and configure any edition of Team Foundation Server including TFS Express.
- Visual Studio with Xamarin – Install an edition of Visual Studio that matches the version installed on developer machines, along with Xamarin for all intended platforms.
- Appropriate Android SDK version – Depending on the projects you intend to build, you may need to install the Android SDK components for API levels beyond what is installed by default with Visual Studio. If not, you will encounter build errors on the server that will indicate the necessary API levels.
Mac OS X Build Host
- Xamarin Mac Agent – To build iOS apps from a Windows developer machine or the TFS machine, you must have a Mac OS X build host machine on your local network. For more information, refer to the Xamarin Mac Agent guide
- Firewall Configuration for Xamarin Test Cloud – Internet access to the Test Cloud web servers is required. Firewalls should be configured to allow traffic to the Test Cloud servers at the IP addresses 220.127.116.11 and 18.104.22.168. The Test Cloud servers require ports 80 and 443.
Note: The Android SDK must be installed in a location that's accessible by the build agent account, such as C:\android-sdk, and not in another user's account. This will be covered in Configuring the TFS Server to Build Android Apps.
Required User Rights
Before a user can create a new Team Project in Team Foundation Server they must be members of the team project and have administrator permissions for team project collections. For details, see Microsoft’s documentation, Add users to team projects and Add accounts to administer project collections.
With all the above steps completed for each member of the team that will be working on projects within the Team Collection, those members are now ready to connect to the TFS server.
Note: A team project in TFS and VSTS refers to all the project's data that includes tasks, work items, version control, build definitions, test definitions, and so forth. App projects, on the other hand, as they appear inside an IDE like Visual Studio and Xamarin Studio, define the source files necessary to build an app package. App project files are themselves stored in the team project's version control repository.