Fixing: Xamarin with .Net Standard in Visual Studio 2017 v.15.3

Personal Blog: Not representative of Microsoft.

By modifying the .CSProject Profile you will be able to have your .NET Standard Library work as intended with Xamarin!

Error:

Package Xamarin.Forms 2.3.4.267 is not compatible with netstandard1.4 (.NETStandard,Version=v1.4). Package Xamarin.Forms 2.3.4.267 supports: 

Original Post:

https://forums.xamarin.com/discussion/86139/targeting-net-standard?
Came across the post after having issues with my project.json file not working anymore after the latest update.

 

Here is my Fix:

Then change the .csproj file to the following for netstandard1.4 as the example.

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
 <TargetFramework>netstandard1.4</TargetFramework>
 <PackageTargetFallback>$(PackageTargetFallback);portable-win+net45+wp8+win81+wpa8</PackageTargetFallback>
 </PropertyGroup>



Other stuff here
 </Project>

How it Works?

Basically we are telling the project that it can accept any of these “fallback” or second option targets, this enables a lot more compatibility with older NuGet Packages.

<PackageTargetFallback>$(PackageTargetFallback);portable-win+net45+wp8+win81+wpa8</PackageTargetFallback>

 

Clean Build -> Compile & It works 🙂

How to Fresh .Net Standard Project in Xamarin:

  1. Create .Net Portable Xamarin Project
  2. Create a new Standard Library
  3. Edit the Standard Library .csproj file as shown above
  4. Copy the files from the Original Portable Library into the NEW .Net Standard Project
  5. Add the Required NUGET Packages
  6. Reference & Compile!

Here’s my test project if your interested in seeing it..

(50mb download, I just zipped up my entire project)
Test File