.NET Standard with Xamarin Forms Gotchas

After a week of converting a production project to .NET Standard via the methods in .NET Standard Library with Xamarin Forms, I think I have come across most gotcha’s programmers are going to come against with .NET Standard in a Xamarin Forms environment and I wanted to also answer a few questions that I initially had coming to .NET Standard to help others with the transition.

Feel free to email me if any of this is incorrect or has now changed since the tooling in particular is in a heavy state of flux, even though .NET Core when to final, the tooling didn’t.

if you haven’t read my previous .NET Standard Library with Xamarin Forms article and are new to .NET Standard, please read that first.

What exactly is the benefit of .NET Standard?

  1. It allows support of possible future platforms without recompilation. Remember with PCL’s you have to tick each platform you support and go back and change if you need to support another platform.
  2. Common defined set of API’s that can be supported on different platforms.
  3. PCL’s are based on Microsoft Platforms, .NET Standard Libraries are platform agnostic.
  4. PCL’s were an intersection of API’s, .NET Standard Libraries are subsets built on top of each other.
.NET Standard netstandard 1.0 1.1 1.2 1.3 1.4 1.5 1.6
.NET Core netcoreapp 1.0
.NET Framework net 4.5 4.5.1 4.6 4.6.1 4.6.2 4.6.3
Mono/Xamarin Platforms *
Universal Windows Platform uap 10.0
Windows win 8.0 8.1
Windows Phone wpa 8.1
Windows Phone Silverlight wp 8.0


This one started confusing me initially, probably due to the many other errors I was receiving. Can I reference a higher version of .NET Standard or lower versions, which way does it go?

You can reference a LOWER version. For example:

  • If you have project 1 with netstandard1.3 you can reference project 2 which has netstandard1.1. This is in a direct project reference inside Visual Studio. The other way around results in an error. [ 1.1 can not reference 1.3, but 1.3 can reference 1.1  ]
  • With AutoMapper, which has 1.1. and 1.3, I can reference successfully from a 1.4 project, but not from 1.0.

A higher version number can always reference a lower version number but not the other way around. A higher version number supports more API’s hence it makes sense that it can reference a lower version number, which just has a subset of the higher version API surface.

What API’s are included in each .NET Standard Version?

David Fowler is here to the rescue with his how .NET Standard relates to .NET Platforms code example. It is just an interface definition but so revealing on how it works and what is included at each version.

Project.json, I thought that was dead?

I updated my original post with this information but in case you missed it. Is project.json dead? Well it is, sort of. What is happening is the project.json is having parts moved back into the .csproj as they move back to msbuild. However project.json will still remain to handle nuget dependencies or it may get called nuget.json or something similar in the future. You can listen to this announcement at ASP.NET Community Standup – May 10th, 2016 (I set this link to start at 28:30 where Damian starts talking about the change)

.NET Standard Library 1.6 isn’t netstandard1.6?

This is an initial confusing part. In order for your library to support .NET Standard it needs to have a reference to NETStandard.Library, which is currently at version 1.6. But this doesn’t mean what .NET Standard Library it supports. it supports all 1.0 to 1.6. Version 1.6 just references the version of this library. The library version has nothing to do with the netstandard version.

.NET Portable Compability Nuget Package

This caused quite a few problems for myself and didn’t write down the errors I experienced. (apologies I will add them back if I come back across them). However I found that you can remove this package, still reference PCL’s and use it in a Xamarin Forms project. However if you have errors, please read the Microsoft.NetCore.Portable.Compatability nuget page to see what it does.

Interesting side note, this works very well on all netstandard versions, even though it only has netstandard1.0 support.

Resources (Resx)

If you remove the .NET Portable Compability Package, you can no longer create or modify through the GUI Resx files. However you can still add in a Resx and modify it manually. I normally remove the .designer.cs file anyway because I don’t like the auto generated file reference.

If you are doing UWP or WinRT you might have already come across the fact you can’t use PCL Resx files as they use Resw. Fortunately these are extremely similar and you can just copy the Resx file to a Resw file and it works. Email me if you want me to do a post further explaining this.

Is .NET Standard part of .NET Core?

.NET Core and .NET Standard get used a lot together, in order to properly build with .NET Standard you need the .NET Core for Visual Studio tooling but I still wasn’t clear on how they were related. But .NET Standard isn’t part of .NET Core, its a definition of API’s available and it runs on .NET Core but also on other platforms.


Image referenced from Scott Hunter presentation on .NET Overview

Visual Studio Team Agent (VSTS)

If you want to build your Xamarin project on VSTS, at the moment you will need to currently run your own Build Agent and you can’t use the Hosted Pool. This is due to the currently installed software on the default build agent.

It includes Xamarin 4.0 but we need 4.1 to get it to build. Nuget is another issue and I needed to upload the latest Nuget 3.5.0-beta2 into the build agent and it managed to successfully restore all packages. One day they will upgrade the Xamarin component on the build agent and this won’t be an issue but it is at the moment.

3rd Party Libraries

From experience (no scientific study here) I am seeing a lot of packages providing a netstandard1.3 reference, with only a few providing a netstandard1.1 reference as well. This is leaving WinRT behind. It looks like WinRT projects might be pushed to upgrade to UWP and leave WinRT and Windows 8.1 in the past.

Where did dotnet5.1 to dotnet5.4 come from and go?

If you ever came across these over the past year, these are the old names of netstandard. netstandard1.1 is the new name of dotnet5.1 and so forth. This helped alleviate a lot of confusion as when most developers first see this like me I immediately think of .NET 4.6 and go, is this a new version of the CLR? How did I miss this?


These were the questions I had coming across to .NET Standard and hopefully I have answered most of your questions that allows you to jump straight in. If you have any more please email or tweet me.