Visual Studio: How to Pair to Mac for iOS Development on Windows

I have to start this post by pointing out what a major bonus it is for .NET developers that you can build, deploy and debug an iOS application on Windows – that’s right, if you didn’t already know this, if you’re using Xamarin (now net6 ios/android), Xamarin.Forms (now dotnetmaui) or Uno Platform, you can do all your development and testing for iOS from within Visual Studio on Windows! In order to run and debug your iOS application, you’re still going to need a Mac which Visual Studio needs to pair with. Microsoft provides details instructions on how to Pair to Mac for Xamarin.iOS development, so instead of recapping it here, I’m going to focus on a couple of issues that are currently plaguing developers trying to use this feature.

At this point I will point out that anyone having issues pairing Visual Studio to a mac, should first refer to Microsoft’s Connection Troubleshooting guide that has a number of useful hints.

XCode Version

As you can imagine there are a lot of moving pieces that Microsof is stitching together to get remote iOS debugging to work: Visual Studio, Visual Studio for Mac, XCode, to name just a few. So it’s not surprising that you need to make sure you’re running a supported combination of the tools.

For Visual Studio and Visual Studio for Mac, this typically means sticking to the same channel – if you’re using the preview version of Visual Studio, you’ll want to be on the preview channel within Visual Studio for Mac.

Unfortunately, Microsoft doesn’t have as much control over XCode versions and often the support for the latest XCode version lags. This is the current situation where XCode 14 (latest at the point of writing) isn’t supported (at the point of writing). Instead you need to download XCode 13 and set it as the default. Microsoft has a wowfully inadequate page covering how to download old versions of Xcode – finding and downloading XCode is only half the story. Luckily there are various posts that show how to use xcode-select or setting the command line version within Xcode.

Note: One of the symptoms of not having the correct version of XCode is that after Visual Studio successfully pairs to the Mac, it fails to load the list of available simulators. If you have this issue, I suggest checking to make sure you’re running a supported version of XCode.

SDK Issues

The introduction of workloads to Visual Studio has been a complete farce, causing issue after issue. Whilst it seems to have settled down a little, now that net6 for ios/android has shipped, it does feel like every update to Visual Studio brings with it some workload related issues. The latest round of updates to Visual Studio introduced an issue where an incorrect version number was preventing Visual Studio from being able to pair to mac.

Whilst the GitHub issue was moved, and closed, by Microsoft (they use a truly bizzare way of managing community issues that involve closing issues when they’ve been received, rather than when they’ve actually been fixed), the community has pitched in with solutions on how to fix this issue. Check out the issue here for the workaround – essentially you need to update the WorloadManifest.json file on Windows and restart Visual Studio, as well as clearing out the XMA folder on the Mac

This is just a couple of the issues and workaround that hopefully will make it easier for you to pair Visual Studio with your Mac and allow you to continue to debug your iOS application, without having to leave the comfort of Windows.