This article shows how to set up Xamarin.iOS for Visual Studio. It covers the installation process for the Xamarin plug-in for Visual Studio, and discusses the steps for pairing a Macintosh Build Host 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, so we can build iOS applications using Visual Studio.
Developing for iOS inside Visual Studio lets you:
- Create a single cross platform solution for iOS, Android and Windows applications.
- Use Visual Studio tools (such as Resharper and Team Foundation Server ) for all your cross-platform projects, including iOS source code.
- Work with a 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 (using Parallels or VMWare), or when a Mac Build Host is connected to the same network as a Windows machine with the tools installed.
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 – 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 connection to 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.
The system requirements are:
- Windows 7 or higher.
- Visual Studio 2010 Professional or higher.
- Xamarin’s plug-in for Visual Studio.
You cannot use the Xamarin plug-in with Express editions of Visual Studio due to lack of plug-in support
- A Macintosh running OS X Mountain Lion or higher (although we recommend the latest version).
- Xamarin iOS SDK.
Apple’s Xcode IDE and iOS SDK (we recommend the latest version from the App Store).
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.
- Storyboard support using the iOS Designer
Deploy and debug iOS applications , where the app itself runs in a simulator on the network-connected Mac, or a device connected to the Mac.
There are some tasks that Xamarion iOS for Visual Studio currently cannot do:
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 Xamarin has been installed on your Mac, ensure that you have turned off your firewall to allow Visual Studio to connect. To do this:
- 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 .
You may also want to read the Xamarin Firewall Configurations Instructions to ensure there are no additional endpoints you need to whitelist.
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 for Windows and run it.
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.
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.
This does not apply to Windows 8.1
The Xamarin Installer will guide you through the steps necessary to install your Xamarin software.
Once the installation is done, Visual Studio is started automatically in the background so you can start building iOS applications right away.
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 10 on a Macbook Pro with Retina Display, you should
check the Video Hardware Settings to ensure Enable Retina resolution is not checked (in previous versions of Parallels you would select the Scaled option). If this is not set correctly
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:
- Link Your Xamarin Account – Ensures that all features you are entitled to are enabled. You can create a new Xamarin Account if required.
- Connect Visual Studio to the Mac Build Host – Visual Studio must be connected to the Mac Build Host before it can work with iOS projects.
- Configure the Visual Studio Toolbar – Lets you 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 an iOS project in Visual Studio after installation. You can update the Mac Build Host settings later from the Tools > Options > Xamarin > iOS Settings panel in Visual Studio.
The version of Xamarin.iOS on the Mac and under Visual Studio must be identical. The simplest way to ensure this is to that is to ensure both machines are running the same branch of Xamarin.iOS (for example, both on the Stable branch)
If they are running on different versions, there is a good chance that the build host will not connect
Mac Build Host Detected Automatically
When the Configuration Wizard opens, it shows instuctions for how to open the Xamarin Build Host on the Mac using Spotlight:
On your Mac:
Open the Xamarin Build Host
Choose Pair. The Build Host will provide you with a PIN:
Switch back to Visual Studio and choose Next in the Configuration Wizard. If your Mac is correctly configured, the Wizard will list it as a possible Build Host:
Choose your Mac Build Host and click Select. Visual Studio will then ask for the PIN:
Once the machin PIN is entered, Visual Studio will connect to the Build Host and let you compile, deploy and test iOS projects.
To unpair the Build Host from Visual Studio, open the Xamarin.iOS Build Host and click Invalidate PIN:
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.
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
Choose the Build category
Visual Studio 2013
Click the menu button at the right side of the Standard bar:
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.
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.