Review: Xamarin 2.0 works mobile development magic
Impressive Xamarin SDK brings native iPhone and Android development to C# programmers, Visual Studio
Xamarin setup: Mind your step
A quick check with Xamarin tech support confirmed that the MacBook Pro I use for iOS development was suitable. This Mac has 8GB of RAM and runs Mac OS X 10.7 (Lion). I had the Apple Xcode 4.5.2 tools already installed, along with a number of code-signing profiles set up for debugging code on an iPhone 4 and iPad. From my experience, configuring profiles in Xcode is a fussy business, so I took no chances by making and testing a profile just for Xamarin work.
A Windows machine wasn't available, so I used VMware's Fusion 5.0.3 to set up a virtual PC on the Mac. The virtual PC ran Windows 8 Professional, and I installed the Visual Studio 2012 tools on that. Note that you cannot use the Express version of Visual Studio for code development with Xamarin.
The installation process is lengthy. The Xamarin installer downloads and installs a lot of files on both the Mac and the PC, such as the SDK components, the IDE, and Android SDK (if it is not present). However, I didn't experience any problems with either the Mac or PC installations.
I started on the Mac side with the Xamarin Studio to weed out any issues with the iOS tools and profiles before switching to the PC side. I downloaded the source for a Xamarin cross-platform example app to have something to work with. The example consisted of a solution containing three projects. The first project had the common code, the second had code for the Android platform, and the third had code specific to iOS. You can start builds for the complete solution (which constructs the Android and iOS versions of the app) or separately. Xamarin's per-project build control reminded me of CodeWarrior.
I built both versions of the app, and when I went to debug the code, the iOS and Android simulators appeared on demand. I could set breakpoints, view variables, and step through the code. Debugging the iOS app on an Apple device took some work, because that's when the code signing comes into play.
I initially got error messages about an invalid profile when trying to download to the iPad. Knowing that the profile was good, I went through the various iOS build settings in Xamarin Studio and tracked the problem down to blank fields for the app name and bundle identifier. Xcode creates default values for these settings, while Xamarin does not -- oops. After I entered valid information into these fields, I was able to debug the app on both the iPhone and iPad from Xamarin Studio. I did not have an Android device to test hardware debugging.
I switched over to the PC side and fired up Visual Studio, then opened one of the example iOS projects. To build the app you have to first connect to the Mac build server. I chose Tools > Options and under the Xamarin iOS settings looked for a Mac build host. Sure enough, there was the MacBook-Pro.local build server, and I clicked on it. That's all it took. I then had Visual Studio build the project, and the remote build went smoothly.
Xamarin has this process down to a science -- I never experienced any problems with the iOS builds. When I started the debugger, the iOS simulator appeared, and I was able to use Visual Studio to set breakpoints and step through the code. Considering all the layers of emulation and redirection, what Xamarin has accomplished is pretty amazing.