News

Xamarin Extends Cross-Platform Reach

Xamarin, the cross-platform mobile app development tool recently acquired by Microsoft, can now share code across more of those platforms with its new support of .NET Standard Libraries.

Xamarin is known for its ability to create mobile apps for iOS and Android (and other platforms) with one codebase written in C#, the primary programming language for development with the Microsoft .NET Framework in Visual Studio.

With the new .NET Standard Libraries support, it can now be used to share code among more .NET platforms, such as the recently open sourced .NET Core and ASP.NET Core.

The .NET Standard Libraries can be thought of as in improved Portable Class Library, according to a blog post published yesterday by James Montemagno. They specify APIs that can be used on all .NET runtimes, thus any .NET Standard Library will support any runtime that supports .NET Standard Platform.

"Today, we are extremely pleased to release support for .NET Standard Libraries for all Xamarin applications," Montemagno said. "This includes creating and consuming local .NET Standard Libraries, but also adding .NET Standard Libraries from NuGet directly to your Xamarin apps."

Xamarin Support for .NET Standard Libraries
[Click on image for larger view.] Xamarin Support for .NET Standard Libraries (source: Microsoft)

"The .NET Standard Library is a formal specification of .NET APIs that are intended to be available on all .NET runtimes," Montemagno continued. "You can think of it as a simplified, yet expanded, Portable Class Library. It is a single library with a uniform API for all .NET Platforms including .NET Core. You just create a single .NET Standard Library and use it from any runtime that supports .NET Standard Platform."

Microsoft said the .NET Standard Library enables the following scenarios:

  • Defines uniform set of BCL APIs for all .NET platforms to implement, independent of workload.
  • Enables developers to produce portable libraries that are usable across .NET runtimes, using this same set of APIs.
  • Reduces and hopefully eliminates conditional compilation of shared source due to .NET APIs, only for OS APIs.

The new functionality works in the Xamarin Studio IDE (today updated to version 6.0.2 to support that functionality) and in Visual Studio 2015, provided the latter has Update 3 installed and is updated to include Xamarin 4.1.2.

While today's announcement heralds the ability to consume and compile the .NET Standard Libraries in the updated Xamarin Studio 6.0.2, "The ability to create .NET Standard Libraries in Xamarin Studio on macOS will be available in the future," Montemagno said.

About the Author

David Ramel is an editor and writer at Converge 360.