This article shows how to build, and test Xamarin iOS applications using Visual Studio. It will explain how to use Visual Studio to create new iOS projects, build an iOS application and then compile, test and debug using a networked-Mac to host Apple’s compiler and simulator, and Xamarin’s build toolchain.
Overview
Xamarin iOS for Visual Studio allows iOS applications to be written and tested on Windows computers, with a networked Mac providing the build and deployment service.
This article covers the steps to install and configure the Xamarin iOS tools on each computer, in order to build iOS applications using Visual Studio.
Developing for iOS inside Visual Studio provides a number of benefits:
- Creation of a single cross platform solution for iOS, Android and Windows applications.
- Using Visual Studio tools (such as Resharper and Team Foundation Server) for all your cross-platform projects, including iOS source code.
- Using the familiar (for existing Visual Studio developers) code editor, keyboard shortcuts, etc.
Xamarin.iOS for Visual Studio supports configurations where Visual Studio is running inside a Windows virtual machine on a Mac (eg. using Parallels or VMWare).
Requirements & Installation
See the Installing Xamarin.iOS for Visual Studio document for installation instructions.
Visual Studio Features for iOS
This section introduces the new Visual Studio features that support Xamarin iOS development. These include:
- Build Host Settings
- Visual Studio Toolbar
- File > New Project for iOS applications
- iOS Project Properties
Build Host Settings
Go to Tools > Options in Visual Studio to access the iOS Mac Build Host settings. Choose the section to see this screen:
You can change the BuildServerAddress by typing in the box or clicking the ellipsis button […] that appears when it has focus. The following screen is displayed to update the Mac Build Host:
Visual Studio Toolbar Overview
The Xamarin iOS for Visual Studio plug-in adds an item to the Standard toolbar, plus the new iOS toolbar. The functions of these toolbars are explained below.
Standard Toolbar
The controls relevant to Xamarin iOS development are circled in red.
- Start – Starts debugging or running the application on the selected platform. The Mac Build Host must be connected (see the status indicator in the iOS toolbar).
- Solution Configurations – Allows you to select the configuration to use (eg. Debug, Release, Ad-Hoc, AppStore).
- Solution Platforms – Allows you to select iPhone or iPhoneSimulator for deployment.
iOS Toolbar
The iOS Toolbar in Visual Studio looks like this in Visual Studio 2010:
In Visual Studio 2012 it looks like the following:
The toolbar contains the these items:
Each item is explained below:
- Target iOS Device drop down – Use this to choose which simulator or device to deploy your application to. The contents of this list changes depending on the Solution Platform selected in the Standard toolbar.
- Connected to Remote Server indicator – Will be green when a Mac Build Host is available and connected; red if not.
- Refresh Server Info – Refresh Mac Build Host information, such as after a device is attached.
- Show IPA File on Build Server – Opens the Finder on the Mac to the location of the application’s IPA output file.
- Clean Remote Log – Cleans the log on the Mac Build Host.
- Show iOS Simulator – Brings the iOS Simulator window to the front on the Mac Build Host.
iOS Output Options
Output Window
There are options in the Output pane that you can view to discover build and deployment messages and errors.
- Mac Server Log – Contains detailed build and deployment information from the remotely connected Mac.
- Debug – Contains the debug output from the application, as with any Visual Studio project.
iOS Project Properties
Visual Studio’s Project Properties will let you configure your iOS application, as shown in the screenshot below:
- iOS Bundle Signing – connects to the Mac Build Host to populate the code signing identities and provisioning profiles.
- iOS IPA Options – the IPA file will be saved on the Mac Build Host’s file system.
- iOS Application - Application settings including the bundle identifier, support orientations and default screen images.
- iOS Run Options – Configure additional parameters.
- iOS Crash Reporting - TestFlight crash reporting support, same as Xamarin Studio for OS X.
File > New Project for iOS Applications
Creating a new iOS project from within Visual Studio is just like any other project type. The screenshot below shows some of the templates available for creating a new iOS project.
Storyboard and XIB files (used by Apple’s Interface Builder for GUI design) cannot currently be edited in Visual Studio. If you create an application from a Storyboard template (or a template that includes XIB files) then you’ll have to switch to the Mac and open the entire solution in Xamarin Studio. From within Xamarin Studio, double-click on XIBs or Storyboards to open and edit them. This includes adding a new item after the project is created, from the following options:
Working with Storyboards and XIBs
Editing storyboard and XIB files must be done on OS X with Interface Builder. The Xamarin.iOS plug-in for Visual Studio does not provide any support for this.
Running & Debugging iOS Applications
Set debugging stops
Start debugging, and use the simulator or device to navigate your application to a breakpoint. When a breakpoint is hit the line will be highlighted and Visual Studio’s normal debugging behavior is enabled: you can step into, over or out of the code, examine local variables or use the Immediate Window.
This screenshot shows the iOS Simulator running next to Visual Studio using Parallels on OS X.
Examine local variables
Summary
This article described how to use Xamarin iOS for Visual Studio. It listed the various features available for creating, building and testing an iOS app from within Visual Studio and walked through building and debugging a simple iOS application.



















