F # .NET Standard Library Project

I have a Xamarin Forms solution that contains several class libraries for the F # class.

To use the latest version (4.0.0) of Microsoft.Azure.MobileClient, I need to upgrade to FSharp.Core 4.2.1, but this is incompatible with profile 78:

Failed to install package "FSharp.Core 4.2.1". You are trying to install this package into a project whose target is '.NETPortable, Version = v4.5, Profile = Profile78', but the package does not contain assembly references or content files that are compatible with this framework. For more information contact the author of the package.

It is possible to use .NET Standard Class Libraries from Xamarin projects, but is it possible to create a .NET Standard Class Library in F #?

What's the best way to promote here?

+3


source to share


2 answers


That error message tells you that the project is targeting a PCL target. FSharp.Core 4.2.x no longer has a PCL target and only contains .NET Framework and .NET Standard 1.6 files. Also not compatible with the PCL target used here by F #.

The release notes for FSharp.Core were recently updated with the developer guide: https://www.nuget.org/packages/FSharp.Core/

This is the important bit for your project:



For existing packages targeting .NET Frameworks 4.0 or lower and PCL, use FSharp.Core 4.1 or lower.

The .NET standard (since that time) has not yet spread across all .NET. As @Foole says, you can actually create a .NET Standard Class Library with F # today. But it is incompatible with the rest of the .NET ecosystem until .NET Standard is fully supported in all flavors of .NET.

+2


source


You can try to convert your Xamarin.Forms project (and your F #) from .NET Portable to .NET Standard 2.0, as both packages can be added to .NET Standard.

How to convert Xamarin.Forms to .NET Standard



  • Create a new Xamarin.Forms project (skip for already created project)
  • Create a new .NET Standard library project in the same solution
  • Add Xamarin.Forms Package Reference
  • Copy your content from the Xamarin.Forms shared project to the new library project.
  • Change all links (from Android, iOS, UWP) to point to the library project and not the shared project

Source: Xamarin Blog

0


source







All Articles