Read on for more:
The .NET ecosystem is undergoing a massive transition - we think for the better. When we developed the previous version of the Snowplow .NET Tracker, it was enough to target desktops and servers, and the project was anchored to a .NET framework version, rather than a set of platforms.
However, it didn’t take long for new platforms to appear (and to disappear, in some cases). From these changes came “portable class libraries” or PCLs. A PCL is one .NET project anchored to many platforms; PCLs are defined as the subset of all the given features across every platform. In other words: if SomePlatform supports features (A, B, C), and AnotherPlatform supports features (B, C, D), then a PCL targeting both SomePlatform and AnotherPlatform can only use the features (B, C).
We think that the likely intention of PCL was to drive development across all of the .NET platforms into a natural convergence. Unfortunately, this didn’t really happen, and so .NET Standard was born as a new harmonization initiative.
.NET Standard is a base class library (BCL) that platforms must be able to execute. This in turn means that libraries can now use a single, unified base class library, and it’s up to each platform to provide this. With .NET Standard the functionality that library developers can offer does not diminish as the number of platforms you want to support increases.
Platforms that support newer versions of .NET Standard can run libraries that target older versions of the .NET Standard library. Libraries can then re-target to a newer version of the .NET Standard to expand the API available to them.
All of this means that developing libraries in .NET just became a lot more straightforward - and including them in your application should become easier too!
If you’re new to .NET or returning after a break - there’s a great video series here by Immo Landwerth of Microsoft, with more information on the ecosystem changes and the reasons behind them.
We’ve made the move to .NET Standard for the Snowplow .NET Tracker for a number of reasons.
The first is that we can support tracking events on many more platforms and device types. This includes Xamarin (iOS/Android mobile), Linux and macOS (through .NET Core). It would have been possible for us to achieve this with a PCL but the development overhead was high. With our new approach, as new platforms emerge the tracker will automatically support them through .NET Standard support.
We also think that by using .NET Standard it should be easier for developers to use the tracker across very different environments, carrying a familiar codebase across each.
Of course it’s not quite as simple as converting everything to .NET Standard. We’ve now split the Tracker into two NuGet packages:
Snowplow.Tracker, a fully functional .NET Standard library for tracking Snowplow events
Snowplow.Tracker.PlatformExtensions, a PCL wrapper extending the functionality of
Snowplow.Trackerin platform specific ways, e.g. providing mobile contexts on Xamarin
Which of these libraries you’ll use will depend on your use case:
Snowplow.Tracker.PlatformExtensions NuGet package. This provides extra mobile-friendly features out of the box including access to information on the user’s device type, operating system and app usage sessions.
You can use either the
Snowplow.Tracker.PlatformExtensions NuGet package or the base library
Snowplow.Tracker (also available via NuGet).
Our platform extensions library provides a .NET 4.6.1 implementation - but you can also use the base library (.NET Standard 1.4 libraries can be used directly by .NET 4.6.1+ platform code).
The advantage in using the platform extensions is some additional features - for example an “offline mode” where the tracker will not try to send events when the host is offline. The advantage to using the base library is that if you’re multiplatform already (or planning to be) using .NET Standard libraries will simplify your deployment and development process.
Not all platforms are supported as a PCL within
Snowplow.Tracker.PlatformExtensions. A good example of this is .NET Core.
In this case, you can still use the
Snowplow.Tracker package. The
Snowplow.Tracker package is the base library and contains everything you’ll need to track events on any platform. It targets .NET Standard 1.4 and therefore supported by these platforms.
There’s a quickstart guide available here. You might also be interested to see our demo applications for .NET Core and for Xamarin. Details on specific tracker functions are available in the wiki documentation. A set-up guide is also available in the wiki.
If you’ve found a bug or technical issue - please raise an issue!
We hope that Microsoft’s aquistion of Xamarin will result in the .NET Standard feature =set expanding to incorporate mobile-centric APIs - which we’ll always strive to move into the core library. Although the ecosystem is in flux today we’re expecting great things in the future!