Sharing War Stories: The Best Way To Swap Between Xamarin Studio & Visual Studio

Some of the best ways to become a better software developer, in general, is to listen to other people’s experiences and learn from them.  As a consultant, I’ve had the privilege of working with some of the brightest and talented software developers I have ever met.  I enjoy working with people who are smarter than me for two reason.  First, I learn how to approach problems in different ways I would have never have though of.  Second, I can take other peoples experience and retrospectives and add them to my tool belt of knowledge.

So I’ve decided to start a series on this blog, and this is the first post in that series.  I’m calling it “Sharing War Stories” and its intention is to take my experiences and share them with the rest of the community.  These stories are going to be things that can’t necessarily be found in official documentation.  It’s about solving certain issues or problems based on hands-on, real-world experience.  In short, the theme for this series is about how things are done in the field that you can’t find anywhere else.

So without further adieu, here is the first article in this series.

The Problem

In building Xamarin.iOS projects, the main problem is developing the user interfaces.  My preferred IDE (most of the time) for developing mobile apps is Visual Studio.  However, building user interfaces with Visual Studio has some limitations.  Here were my main problems.

First, the Storyboard Designer in Visual Studio, though powerful, still has some limitations (compared to XCode).  Bust most importantly, I don’t like to use Storyboards. :) That is another discussion/debate that deserves it’s own blog post.  But for the time being, let’s just say that Storyboards are not very cross-platform friendly.  And since I’m in the mobile cross-platform business, I’m going to stay away from Storyboards.  Instead, I still build user interfaces that are XIB based.

Second, the Xamarin Visual Studio plug-in does not support editing XIB files.  Visual Studio will create XIB files, but in a sense if irony, you can’t edit those files using the built-in designer.  Xamarin Studio on the Mac doesn’t support XIB files either, but Xamarin Studio will open XCode if you want to modify XIB files and automatically sync the changes back up with Xamarin Studio.

Third, I found it a real pain to copy source code from a Windows machine to a Mac, modify the files, and then copy the files back.  And to top it off, nearly all of my clients use Microsoft Team Foundation Server for their source control system.  This is the defacto standard for most enterprise environments, or at least the ones I’ve work with.  Unfortunately, there is not a nice solution to connect to TFS from a Mac.  Xamarin Studio does not support TFS natively on a Mac.  One can use the TFS Eclipse Plug-in, which works sometimes.  But most of the time, it crashes and is pretty painful to work with.  In short, it sucks.

My Requirements For a Better Solution

So in my search for a better solution, I came up with the following requirements:

  1. MUST natively support TFS for source control and work item tracking.
  2. MUST have the ability to create and edit XIB files for Xamarin.iOS projects.
  3. MUST have Resharper like capabilities for developer productivity.

Given those three major requirements, neither Xamarin Studio nor Visual Studio can meet all 3 of those requirements.  So the solution I came up with was to use both.  But swapping between the two can be painful, especially if your Mac Host and Windows Machine are two different physical machines.

The Solution

My solution was to use a Mac as my main development machine, and then run a Windows virtual machine (VM) so that I can run Visual Studio.  So here is my setup:

  • Physical Machine:  Macbook Pro w/ 16GB of RAM and Solid State Drive
  • Virtual Machine Software: VMWare Fusion
  • Windows VM: Windows 8.1 with Visual Studio 2013 installed

The Details

I first started typing this up and soon realized that I was about to write a lot of content.  It would have made for a long blog post, and felt like I would probably lose your attention.  So I decided to try something new and created a video tutorial showing you how to setup your Windows VM using VMWare Fusion, and how to properly host your source code from TFS.  So here’s the video:

Summary

So in summary, here’s the gist:

  • Install VMWare Fusion.  You can download the 30-day Trial Version.  A new license is only $69.99 USD, but well worth the price.
  • Create a Windows 8 Virtual Machine using the VM Wizard.  It’s really easy.  Install Visual Studio 2013/2015.
  • On your Mac File System (not on your Windows File System), choose a location to host your source code.
  • In your Window VM Settings, Share the folder location with the Windows VM.
  • Open Visual Studio, Create/Map your Workspace to the Shared Folder, and perform a Get Latest Version.
  • Swap between Visual Studio and Xamarin Studio with ease while maintaining source control integration!

So that’s my war story!  If you have any questions feel free to leave a comment below!

  • Andres Pineda

    Good you shared your experiences. Basically we both have the same story. The only difference is that I use Parallels instead of VMWare but besides that everything is the same. Excellent!

    • Thanks! That’s interesting that you’re using Parallels and got it to work. I tried Parallels initially, but had nothing but problems with file locks and issues with VS not detecting file changes. Maybe things have improved with newer version. I should re-evaluate it sometime.

    • Ken Kosmowski

      I also have some issues with file locks, especially at check in. Furthermore, VS does not detect changes made in Xamarin Studio. You also had these problems? If yes – how to fix them?

      • Looking back at my notes, I had similar issues when using Parallels. I know it’s not the answer you’re looking for, but my “fix” was switching to VMWare Fusion. I had another work colleague who also had Parallels issues, but didn’t have them with VMWare Fusion. If you’re willing, VMWare Fusion has a feature in where it can convert your Parallels VM to VMWare Fusion. I did that and has been working well for a while now.

        • Ken Kosmowski

          Ok – I should take a look at VMWare Fusion. Thanks

  • Ramon Esteban

    Fantastic post. I’m still using the Eclipse TFS plugin, but I have to try this solution. Thanks!

    • Thanks! I hope it works out for you. Do share if it does, or doesn’t :)

      • Ramon Esteban

        I tried but I had performance issues in my mac mini. I needed to rollback to Eclipse. I hope Xamarin consider in the future to integrate TFS in Xamarin Studio for Mac.

        • On that note, I highly recommend 16GB of RAM . That way you can dedicate 8GB to the Windows VM. If you can get a SSD, it’ll be even better!

  • JasonBSteele

    Can’t storyboards be used for single pages so we get cross platform mvvm AND we can use the vs designer?

    • Certainly! Though the VS designer has improved over the months/year, it’s still not perfect, and performs rather poorly with more complex UI (in my experience). I’ve been doing iOS dev ever since before the VS Designer, so I’ve become accustomed to XCode. But I do agree the learning curve for XCode is high, and is a very paradigm if you have a .NET background.

      With Storyboards, you certainly can have a rule to just use one view controller per Storyboard. That is an option. But in working in a team environment, that does leave the temptation for other developers (who don’t know any better or are new to iOS development) to break those rules and break the architecture because that’s what the majority of tutorials show. I like the XIB approach because it helps enforce those rules. With Storyboards, it requires self-discipline.

      The important thing is that there’s options. There’s no one right way or one wrong way. What I hoped to point out is that there are options, and one should certainly choose the option that best suites the needs at the time.

      • JasonBSteele

        Thanks for the well thought out reply Ruben, glad to know that there is no fundamental reason we shouldn’t use VS designed storeyboards… we just have to be disciplined!

  • Mark Gibaud

    Did you set up key mappings such that they act the same? Swapping between vanilla keymappings on each OS/IDE breaks brains otherwise!

    • Yes! Under the VM Settings page, go to “Keyboard & Mouse”. There should be an option with a name like “Windows 8 Profile” or “Windows Profile”. That will remap the keyboard to the equivalent Windows key (i.e the Command Key is now the Windows Key, etc). You can also click on “Edit” and then “Key Mappings” and map any keyboard shortcuts to your liking.

  • Pingback: Adam J Wolf: Weekly Xamarin Newsletter Issue #43 | XamGeek.com()

  • Pingback: Ruben Macias: Sharing War Stories: The Best Way To Swap Between Xamarin Studio & Visual Studio | XamGeek.com()

  • Hi Ruben, good share. Is Xamarin forms still not a good choice for creating UI for iOS?