Visual Studio Toolbox

Templates and Extensions for Xamarin & Mono

Cross-platform software development has come a long way. Here's a roundup of tools, templates and plug-ins for .NET coding that targets Windows, Mac, Linux, Android and iOS -- even Raspberry Pi and Lego.

Cross-platform application development with real code re-use was a longtime dream for many developers. Java was one of the first. And arguably HTML-based Web apps offer realistic cross-platform targeting, either directly through the browser or native Web-view application containers.

Mono is the third -- and perhaps most important -- cross-platform, native code development platform for Windows, Android, iOS, Linux and Mac OS X to be developed so far. Mono provides an open source, standards-compliant .NET Framework-compatible compiler, runtime and tools for writing native apps in C#.

It's hard to believe the Mono project is 15 years old now. While founder Miguel de Icaza remains with the project, it's had a few corporate sponsors over the years including the original Ximian, Novell, Attachmate, Xamarin and now Microsoft.

While tools and platform development continues under the Xamarin banner, Microsoft acquired Xamarin earlier this year and the underlying Mono platform has been rereleased under the MIT license.

Today you can still download Mono directly and use the MonoDevelop IDE if you like. Some of the platform-specific projects like the monomac bindings to create Mac OS X applications with Mono are also still available, but development efforts have shifted to more "modern" tooling. (There's some very helpful discussion of the history and development status of the older tooling in the answers to the StackOverflow question, "Is MonoMac deprecated?")

Going forward, the Xamarin/Microsoft tools are the way to go. The Xamarin SDK now ships with all versions of Visual Studio 2015. Xamarin Platform is the set of tools and libraries for developing cross-platform software. It includes Xamarin.Android and Xamarin.iOS for developing Android and iOS software (including Apple Watch), respectively. Xamarin.Mac replaces monomac for creating native Mac OS X software. All three offer direct compatibility with the target platform stores (Google Play and Apple App Store).

As a development environment, you can use either Visual Studio or Xamarin Studio. There are free licenses for Xamarin Studio Community and Visual Studio Community. Contact Xamarin for details on Visual Studio Professional and Enterprise licensing. In addition to the development tools, also check out Xamarin Test Cloud for automated mobile app testing and HockeyApp, which provides app distribution for beta testing, crash reports, metrics, and more.

There are many extensions, object collections, and other tools to make your work with Xamarin and Mono even more productive, so let's take a look at what's out there.

Component Libraries and More
Control and component collections for Xamarin development are available from several vendors. Xamarin.Forms UI controls by Infragistics (included with Infragistics Ultimate, and a free trial is available) provides a handy set of chart, gauge, and barcode controls that are great for creating dashboards and data capture applications.

[Click on image for larger view.] Figure 1. Developing an Apple Watch App with Xamarin.Ios in Visual Studio

Syncfusion Essential Studio for Xamarin includes 25 different controls with equivalency across Xamarin.Forms, Xamarin.iOS and Xamarin.Android libraries. Control options include calendars, charts, gauges, maps, ratings, Word and Excel viewers, and more. Syncfusion provides a free trial and Community Edition license, and you can license the entire Essential Studio for Xamarin product on a per-developer or unlimited basis.

Telerik UI for Xamarin provides 10 handy controls for Xamarin.iOS (and slightly smaller selections for Xamarin.Forms and Xamarin.Android) that include controls including chart, list, calendar, drawer, gauge, datasource and dataform, and more. There's a free trial download, and licenses are available for Xamarin.iOS or Xamarin.Android only, a cross-platform package that includes iOS, Android and Xamarin.Forms, or as part of the full Telerik DevCraft Ultimate suite.

Nevron offers controls for Mac OS X development through monomac and Xamarin.Mac in NOV for Mac OS X, part of the Nevron Open Vision for .NET suite of controls. Mac controls include grid, chart, gauge, diagram, schedule, barcode and rich text editor controls. You can download a 60-day trial or purchase licensing for Professional and Enterprise editions of the NOV Open Vision suite.

Visual Studio Templates and Extensions
You'll also find a great selection of project templates, plug-ins, and other Visual Studio extensions for Xamarin and Mono development in the Visual Studio Gallery. Most of these are created by your fellow developers and are free. Thank them if you find the tools useful.

For example, James Montemagno created the Xamarin.Android Templates Pack, which includes project templates for a blank Android application (with support for Material Design with AppCompat) and a navigation drawer project. It also includes item templates for various menu items, an adapter with item reuse, and a recycler view adapter. Montemagno also created a Plugin for Xamarin Templates extension that helps you build your own plug-in and item templates for Xamarin or Windows development. Code for both projects is hosted on GitHub if you want to make a contribution or submit an issue.

Xamarin Forms Templates, by picolyl, provides updated versions of the default Xamarin.Forms Visual Studio project templates that have been revised to reduce the number of errors at project creation and to add some additional templates with support for Android, iOS, Windows 8.1, Windows Phone and Universal Windows Platform (UWP) apps. Again, the project is hosted on GitHub.

Xamarin.Forms Snippets, by Alessandro Del Sole, provides a set of handy IntelliSense code snippets including code to show a modal message, change the target platform font size for controls that have the FontSize property, an implementation of the IValueConverter interface to demonstrate type conversion with data binding, assigning a resource image to Image controls, and getting a control's instance by name. Code is on GitHub if you want to contribute additional snippets.

Cristian Chereches submitted a Xamarin Forms with MvvmCross Solution Template for building Core, iOS, Android and UWP Xamarin.Forms projects using the MvvmCross framework. MvvmCross, by the way, is a .NET Framework-based framework for building cross-platform apps using the Model-View-ViewModel (MVVM) pattern, if the name didn't give it away. This template also includes default UnitTest and UITest projects.

A related extension is the Ninja Coder For MvvmCross and Xamarin Forms plug-in for Visual Studio. Ninja Coder provides a set of project templates, wizards, preconfigured view models and other components, unit tests, and more that help you create MvvmCross-based projects quickly and efficiently, getting the most out of the MvvmCross framework and philosophy.

If Ninja Coder is a bit too heavy for what you have in mind, take a look at the MVVM Light Toolkit. Laurent Bugnion has a MVVM Light for VS2015 extension, as well as extensions for Visual Studio 2012 and 2013. MVVM Light is kind of a minimalist approach to implementing the MVVM pattern, aimed at both new users of the pattern and old hands who want to build their own projects up from a basic set of parts. The MVVM Light extension for Visual Studio provides project and item templates and code snippets for building Windows, Windows Presentation Foundation (WPF), Windows Phone, Silverlight, Xamarin.Android, Xamarin.iOS and Xamarin.Forms projects.

[Click on image for larger view.] Figure 2. The Telerik iOS and Android Listview Control

EMDK for Xamarin is an interesting set of tools and templates for building enterprise apps for Android-based devices with Zebra's Enterprise Mobility Development Kit (EMDK) for Android. One of the key elements of EMDK is the ability to control device behavior and configuration through profiles, which is pretty important when you're supporting large fleets of devices. There are great samples and tutorials on the Zebra site to get you started.

Tools from Xamarin
In addition to the Xamarin SDK and Xamarin Studio, the team has also released additional tools, both officially through Xamarin and as side community projects as "Mobile Essentials."

First, the Enable XAML Language for Xamarin.Forms extension from Mobile Essentials lets you switch the default Visual Studio XML IntelliSense for Xamarin-based projects to an XAML language service.

Xamarin Forms Player is another Mobile Essentials offering that enables you to preview a Xamarin.Forms XAML source in Visual Studio through a device running the Xamarin.Forms.Player app. You build the mobile app yourself, deploy it to your device, then tie the IDE and device sessions together by simply passing a unique code. Very slick!

Xamarin Test Recorder 2015 is an official Visual Studio extension from Xamarin that lets you connect to a device or emulator, interact with your app GUI directly on the device or emulator, record those interactions, and convert them to UITests that are added to your test method. This looks like it could be a great tool, but as I'm writing this there are still some rough edges as it only supports Android devices for now. Make sure you read through the Test Recorder for Visual Studio documentation, as well, because there are very specific configuration requirements for your development environment and test devices.

Tools for Old-School Mono
There are also tools for developing and testing using just Mono. Most of these are designed for Linux deployment, but there are a few general cross-platform toolsets, as well.

[Click on image for larger view.] Figure 3. Xamarin Forms Player Enables Remote Real-Time XAML Previews

MonoRemoteDebugger is a simple client-server application for remote debugging Mono applications running in Linux environments while you're working in Visual Studio.

Mono Tools, by Simon Egli, extends MonoRemoteDebugger with XBuild, pdb2mdb & Mono Migration Analyzer (MoMA) integration for Visual Studio. It's currently in a rough alpha state, but worth keeping an eye on if your work involves cross-platform .NET Framework and Linux deployments.

MonoHelper, by Christopher Dresel, provides XBuild build and run integration into Visual Studio. This straightforward project seems well reviewed and well supported by Dresel. It also works with Visual Studio 2010 through 2015.

Kirk Woll's vs-mono is a custom project template that includes build and remote debugging functionality by default. vs-mono is intended not just for Linux deployments, but has a particular focus on embedded and IoT systems such as Raspberry Pi and Lego EV3.

The TRIK-Upload extension, by Aleksandr Kirsanov, is a similar program for remote deployment of Mono programs from Visual Studio to Linux-based devices like Raspberry Pi and TRIK. Kirsanov's focus here seems to revolve around robotics applications. TRIK-Upload has basic functionality such as deployment, starting and stopping program execution. It also uses a very lightweight SSH communication connection between your development environment and controller. Recent contributions on GitHub look sparse, but the extension is compatible with Visual Studio 2015, 2013 and 2012, and it has great documentation.

You know I love the great documentation.

About the Author

Terrence Dorsey is a technical writer, editor and content strategist specializing in technology and software development. Over the last 25-plus years he has worked on developer-focused projects at ESPN, The Code Project, and Microsoft. Read his blog at http://terrencedorsey.com or follow @tpdorsey on Twitter.

comments powered by Disqus

Featured

Subscribe on YouTube