Xamarin Supports .NET Standard Libraries
Support for .NET Standard Libraries means Xamarin apps can share code among other .NET platforms, including .NET Core and ASP.NET Core.
Xamarin now has support for the new .NET Standard Libraries, which means Xamarin can now be used to share code among more .NET platforms, including .NET Core and ASP.NET Core.
Xamarin, which was acquired by Microsoft earlier this year, is a popular suite of tools for creating cross-platform mobile apps with one codebase written in Visual C#.
The .NET Standard Libraries can be thought of as in improved Portable Class Library, according to a blog post from 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.
"The .NET Standard Library is a formal specification of .NET APIs that are intended to be available on all .NET runtimes," wrote Montemagno. "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 the 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.
David Ramel is the editor of Visual Studio Magazine.