Bug 60301 - F# Android project cannot reference .NET Standard class library
Summary: F# Android project cannot reference .NET Standard class library
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2017-10-20 20:32 UTC by Rob Lyndon
Modified: 2017-10-24 20:25 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 60301 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Rob Lyndon 2017-10-20 20:32:08 UTC
Create a .NET Standard class library using

dotnet new classlib -lang f#

Then create a blank Xamarin Android app in C#, and reference the class library. This works correctly.

Do exactly the same thing, but create the blank app in F#. Trying to reference the class library gives the error "A reference to the library 'MyLib' cannot be added. This project targets a different framework (.NETStandard) from the current project (MonoAndroid).
Comment 1 Rob Lyndon 2017-10-20 20:32:51 UTC
It feels like F# developers are treated like second class citizens in this ecosystem.
Comment 2 Jon Douglas [MSFT] 2017-10-24 17:45:20 UTC
Hey Rob, Thanks for the report!

I am CONFIRMING this issue as per reproduction steps in https://bugzilla.xamarin.com/show_bug.cgi?id=60301#c0 as this happens with both iOS and Android.

Although I am not very aware of the F# community, the roadmap seems to talk "future support" further:


Starting with the release of .NET Core 2.0 and .NET Standard 2.0, all of the changes we have made for F# support in .NET Core 2.0 will be in-box with the .NET Core SDK and .NET Core CLI. Additionally, we have backported in-box support for F# running on .NET Core 1.0.4 and .NET Core 1.1 in the version of the .NET Core SDK that ships with Visual Studio 2017 version 15.3. We’re also working with the maintainers of highly-used open source projects to ensure they work well on .NET Core 2.0 and .NET Standard 2.0.

Secondly it seems like the Visual Studio tooling support is still lacking based on the "Visual Studio tooling support" section:

For long time .NET developers, a common question is "when will Visual Studio support F# .NET Core projects". We’re working hard to get this functionality ready, but unfortunately, we’re not quite happy enough with the quality in the 15.3 update to announce that it’s fully supported. While Visual Studio 2017 version 15.3 is able to open the new F# .NET Core projects, build, and debug them, IntelliSense does not yet work correctly.

I did a little bit of investigation and was unsuccessful on figuring out the initial problem. It seems that the F# targets may not play nicely with the Xamarin target framework although .NET Standard is supported on these platforms. We will investigate this issue further. Thus marking as CONFIRMED as I can reproduce on 15.4 and 15.5
Comment 3 Rob Lyndon 2017-10-24 20:25:25 UTC
Thanks Jon.

There is a .NET Standard branch open in XamarinForms.Reactive.FSharp (an open-source framework I've written): https://github.com/SpiegelSoft/XamarinForms.Reactive.FSharp/tree/dotnet-standard

I have made a C# Android project which references the underlying F# .NET Standard projects. I have tried to build it using MSBuild from the Visual Studio command prompt, but even the C# Android project does not seem to work.

The Android project I'm trying to build is the csproj file in https://github.com/SpiegelSoft/XamarinForms.Reactive.FSharp/tree/dotnet-standard/XamarinForms.Reactive.Sample.Places.Droid

I am working on a project that uses XRF, and I will be very happy to work together on trying to get this working.