This article shows how to set up Xamarin.iOS for Visual Studio. It will cover the installation process for the Xamarin plug-in for Visual Studio and discuss the requirements for a Macintosh with Apple’s SDK installed.
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).
Xamarin iOS for Visual Studio accomplishes an amazing feat: it lets you create, build and debug iOS applications on a Windows computer using the Visual Studio IDE. It cannot do this alone, however, as iOS applications cannot be created without Apple’s compiler, and they cannot be deployed without Apple’s certificates and code-signing tools. This means that your Xamarin iOS for Visual Studio installation requires a networked Mac OS-X computer to perform these tasks for you. Once configured, Xamarin’s tools will make the process as seamless as possible, but the fact remains that a Mac is required in addition to the Windows computer running Visual Studio.
The system requirements are:
- A Windows 7 or Windows 8 computer.
- Visual Studio 2010 Professional or Visual Studio 2012 Professional.
- Xamarin’s plug-in for Visual Studio.
- A Macintosh running OS X Lion or Mountain Lion.
- Xamarin iOS SDK.
- Apple’s Xcode IDE and iOS SDK.
The Windows computer must be able to reach the Mac via the network.
Apple Developer Account
To deploy applications to a device or submit them to the App Store, an Apple Developer account is required. The relevant developer certificates and provisioning profiles must be created and installed on the networked Mac before Xamarin iOS for Visual Studio can work. See the Device Provisioning article for steps to obtain a development certificate and provision a device.
Xamarin iOS for Visual Studio enables the creation, editing, build and deployment of iOS projects from Windows. This includes the following features:
- Create new iOS projects.
- Edit iOS projects and cross-platform solutions that also include Xamarin Android and Windows Phone projects.
- Compile iOS projects and cross-platform solutions that also include Xamarin Android and Windows Phone projects.
- Deploy and debug iOS applications, where the app itself runs in a simulator on a network-connected Mac, or a device connected to a Mac.
There are some tasks that Xamarion iOS for Visual Studio currently cannot do:
- Storyboard and XIB files cannot be edited. There is no drag-and-drop design surface for iOS within Visual Studio. The solution must be opened in Xamarin Studio on the Mac for user interfaces to be created using Interface Builder (for example, to create storyboards or XIBs). Remember to save the changes so that the
.designer.cspartial class is updated and synchronized with the solution on Windows.
- No iOS simulator on Windows. The iOS Simulator runs on Mac OS X, so it’s necessary to switch to the Mac’s screen when testing on the simulator.
Configuring The Mac
Follow these instructions to install Xamarin iOS tools on your Mac host and to activate your Xamarin license.
Once the software is installed, follow the steps in the next section to configure Xamarin iOS on OS X to allow Xamarin for Visual Studio to connect to it.
Once installed, ensure that you have turned off your firewall (to allow Visual Studio to connect). To do this:
- Go to System Preferences… from the Apple menu:
- Select Security & Privacy in the Personal section:
- Select Firewall from the segment control at the top of the window:
- If the firewall is turned on, click the lock (bottom left) so that you can change the setting, then click Turn Off Firewall.
Your Mac is now ready to operate as a Build Host for Xamarin iOS for Visual Studio.
iOS Developer Setup
Follow these links for instructions to setup a Mac for iOS development with Xamarin. These are the same steps regardless of whether you are using Xamarin Studio or Visual Studio; if you’re already a Xamarin iOS developer then you’ve probably already done these steps:
Once your Mac is configured, it’s time to set up your Windows computer.
Download the latest Xamarin unified installer and run it.
Note: on Windows 8 you must run the installer as an Administrator.
The simplest way to do this is start a Command Prompt by right-clicking on cmd.exe and choosing to
Run as Administrator… and execute the installer MSI on the command line:
Be sure the file name is correct.
The installer includes a Xamarin Bonjour Service (Apple’s network discovery protocol), which is installed at the end of the process. Installing the Xamarin Bonjour Service requires Administrator rights, so expect to be prompted twice to allow installation as an Administrator.
The installer steps are as follows:
- Begin the installation process:
- Continue (optionally configure proxy settings using the link at the bottom of this screen):
- Choose which features to install (ensure that Xamarin.iOS is ticked):
- Agree to the Android installation location (if you are also installing Xamarin.Android):
- Review the list of products to be downloaded and installed.
- Tick the box to accept the license agreement.
- The status bar shows installation progress. Progress for each product will be displayed.
- Once installation is complete, you’ll see another progress window while Windows is configured.
- Once the installation is done, Visual Studio is started automatically in the background so you can start building iOS applications right away.
Close this window to exit the installer and begin working with Xamarin.
Xamarin Bonjour Service Installation Error
The Xamarin Bonjour Service installation may fail. If it does, a warning will appear. In this case you can either:
- Start the service manually. Control Panel > Administrative Tools > Services then find Xamarin Bonjour Service and start it, as shown in this screenshot:
- Restart Windows ~ the service starts automatically after rebooting.
Using a Windows Virtual Machine
Xamarin.iOS for Visual Studio can be run inside a Windows virtual machine on OS X, using applications like Parallels or VMWare.
Parallels and Retina Macbook Pros
When using a Windows Virtual Machine inside Parallels on a Macbook Pro with Retina Display, you should change the Video Hardware Settings to use a Scaled resolution. If you don’t change this setting, some elements of the IDE will be poorly rendered and difficult to use.
After the installation process is complete, there are still a few more steps required to get everything working:
- Linking to your Xamarin Account – Ensures that all features you are entitled to are enabled. You can create a new Xamarin Account if required.
- Connecting Visual Studio to the Mac Build Host – Visual Studio must be connected to the Mac Build Host before it can work with iOS projects.
- Configuring the Visual Studio Toolbar – To easily access Xamarin iOS features.
Linking to your Xamarin Account
You must link your Xamarin account to your Visual Studio installation to access all the features you are entitled to.
In Visual Studio, go to the Tools > Xamarin Account… menu item to begin:
The following screen will appear, click Login to your Xamarin Account. You will be given the opportunity to create a new account if you don’t already have one:
Enter your Xamarin Account details, or create a new account:
Once you see the ‘finish’ message, return to Visual Studio:
This screen indicates that your Xamarin Account has been successfully linked to your Visual Studio installation:
Connecting to the Mac Build Host
The Configuration Wizard will automatically start when you open Visual Studio after installation. The following screenshots show the different states that the wizard may appear in. You can update the Mac Build Host settings later from the Tools > Options > iOS screen in Visual Studio.
Mac Build Host Detected Automatically
If your Mac is correctly configured then it should automatically appear in the Wizard, as this screenshot shows:
Choose an online Mac Build Host and click Select. Visual Studio will now be able to connect to the Build Host so that you can compile, deploy and test iOS projects.
No Mac Detected
The wizard may not be able to detect your Mac, in which case the screen will appear without any available hosts to select. This could occur for a number of reasons:
- Mac is not turned on, or the Mac Build Host software has not been installed.
- Mac Build Host process hasn’t started. See the Configuring the Mac section.
- Mac is not visible to the Windows computer on the network. See the Troubleshooting section later in this article.
If you have verified the above points, continue to configure your Build Host manually.
It may be that the Build Host is available on the network but some other error prevents it working correctly with Visual Studio. In this case the host computer name should appear but be listed as offline. Press the Diagnose button in the bottom-left of the window to find out more information about the problem.
A series of tests are run to help determine the issue – the results are displayed in an alert like this:
Clicking on the arrow next to each item will display a description of the test, and in case of failure a suggestion on how to fix it:
If your Mac does not automatically appear in the list, but you believe it is turned on, installed and configured correctly then you can double-click Configure Host Manually in the window to manually configure the Build Host. Manual configuration can help in certain network topologies where a firewall or router is preventing the auto-discovery from working.
Find the Mac’s IP Address in Network Utility… and enter it into the Wizard as shown:
If the Mac still cannot be resolved via the IP Address, refer to the Troubleshooting section regarding network configuration (to verify port availability and firewall settings on the Mac).
Visual Studio Toolbar Configuration
You must manually configure the Visual Studio toolbars, as they will be necessary to perform certain operations. First open the View > Toolbars menu and make sure the iOS entry is selected. Choose the menu item as shown in this screenshot – it should be ticked to indicate that the toolbar is visible:
Add the Solution Platforms button to the Standard toolbar, following the instructions below. This allows an iOS Device or the iOS Simulator to be selected when debugging.
- Right-click the Standard toolbar (the one which has the current configuration drop-down saying Debug, Release etc) and choose Customize… from the menu:
- Switch to the Commands tab.
- Select the Toolbar radio button
- Select the Standard toolbar in the list to the right of the radio button
- Scroll down the Controls widget till you see the Solution Configurations widget and select it
- Click the Add command... button:
- Choose the Build category
- Choose the Solution Platforms command and click OK:
- Click Close
Click the menu button at the right side of the Standard bar:
- Choose Add or Remove Buttons
- Select Solution Platforms
The Standard and iOS toolbars should now resemble this screenshot:
Once the toolbar configuration is complete, you are ready to begin using Xamarin iOS for Visual Studio.
Troubleshooting / Known Issues for Beta
If the software was successfully installed and configured, feel free to skip this section. Otherwise, if there were problems installing or configuring Xamarin iOS for Visual Studio, please read this section carefully.
- If Visual Studio cannot connect to the server, attempt re-discovery. From the Tools > Options > Xamarin > iOS Settings configuration page in Visual Studio, click the build host address field and then the […] button to start Bonjour discovery.
- If Visual Studio still fails to connect to the build host despite performing the steps outlined in the Mac section above,
try the following command (either on Mac or on Windows, remembering to enter the correct IP Address in place of
telnet MAC_HOST_IP 5000
After running the telnet command, disconnect from the server.
If the connection problems persist, start RegEdit on Windows and remove all the values and subkeys from the
The build host log from the Mac is available in the Output window in Visual Studio (obviously only when the build host is successfully connected).
- The following command should show
mtbserverrunning on Mac (from Terminal.app):
ps ax | grep mtbserver
- The output should be similar to:
22765 ?? S 0:05.32 /Developer/MonoTouch/usr/lib/mtbserver/mtbserver -l file
The build host log can be found on Mac in
This article presented a step-by-step guide to installing, configuring, and using Xamarin iOS for Visual Studio.
It covered installing and configuring the prerequisite tools on Windows and Mac OS X.