Xamarin.Mac and netstandard2

Chris Hamons
Aug 14, 2017 · 2 min read

Today is an exciting day in the .NET community as .NET Core 2.0 was released:

However, if you try to use your new shiny netstandard2 libraries with Xamarin.Mac (or iOS) you likely will run into a few issues as official support is scheduled for our next major release d15–4 (XM 3.8 and XI 10.14).

All of them are solvable by installing the correct bits and making a minor tweak to your csproj for now.

First: Install the latest d15–3 release found in the Stable Channel

Second: Install .NET Core 2 (You want the pkg download)

Third: Due to this bug you will need to tweak your Xamarin.Mac (or iOS) csproj until it gets fixed.

Add this line to your reference section:

<Reference Include=”netstandard” />

below

<Reference Include=”Xamarin.Mac” />

(or <Reference Include=”Xamarin.iOS” /> for iOS)

but inside the same ItemGroup.

If, and only if, you are targeting the Xamairn.Mac Full target framework, you will need to additionally add this line:

<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>

in the top PropertyGroup (above UseXamMacFullFramework for example).

After those tweaks, things should “just work”.

As I mentioned, full support will land in the next major release, so please file any bugs you come across.

Chris Hamons

Written by

C# Monkey, Xamarin.Mac Lead