I need to use FSharp 4 , so I installed the nuget FSharp.Core v188.8.131.52 .
Then I have the problem mentionned here: http://forums.xamarin.com/discussion/comment/212937
MSBuild seems to be using an incorrect .Net Framework version.
So in "General Settings", I unckeched "Use MSBuild ...".
In the build log we can see that XBuild is called with:
-r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\FSharp.Core.dll"
A workaround could be replacing FSharp DLLs in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\ by DLLs extracted in ./packages .
It's compiling !
Now I plug my phone on my computer and it try to deploy my app on it (hoping to finally debug) ...
BUT, no APK is generated by XBuild and deploying on devices doesn't work ...
# Steps to reproduce
1. Create a Xamarin.Forms app with F#
2. Install FSharp.Core v184.108.40.206 from Nuget
3. Build the project
# Version information
Xamarin Studio Enterprise
Version 6.1 (build 5271)
Installation UUID: cd0fe011-1678-4f41-b504-7e5ecff01e29
Microsoft .NET 4.0.30319.42000
GTK+ 2.24.26 (Dark theme)
Version: 220.127.116.11 (Xamarin Enterprise)
Android SDK: C:\Program Files (x86)\Android\android-sdk
Supported Android versions:
4.0.3 (API level 15)
4.4 (API level 19)
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
SDK Tools Version: 25.1.2
SDK Platform Tools Version: 24.0.0
SDK Build Tools Version: 23.0.2
Java SDK: C:\Program Files (x86)\Java\jdk1.7.0_55
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) Client VM (build 24.55-b03, mixed mode, sharing)
Android Designer EPL code available here:
Xamarin Android Player
Release ID: 601005271
Git revision: ccf5113663592764e282a0388cedd63d11b28107
Build date: 2016-07-26 15:35:58-04
Xamarin addins: 8d105bffe3a76f192eec36b6df0929d92806791c
Build lane: monodevelop-windows-cycle8
Windows 10.0.10586.0 (64-bit)
Created attachment 16878 [details]
This scenario works for me. I'm able to build and deploy the attached project using the latest Alpha builds XA 18.104.22.168 with XS 6.1 (5298) on Windows. You'll need to add the FSharp.Core NuGet to the Forms library project as shown in the repro I've attached.
Are you able to reproduce with the attached project? Am I missing a step?
You added FSharp.Core NuGet only in the PCL project.
In my case, I want to use FSharp 4 in Android project too.
Try to compile with:
1 - In PCL:
type App() =
let stack = StackLayout(VerticalOptions = LayoutOptions.Center)
let label = Label(XAlign = TextAlignment.Center, Text = "Welcome to F# Xamarin.Forms!")
base.MainPage <- ContentPage(Content = stack)
let text = "coucou"
if isNull text
2 - In Android:
[<Activity (Label = "Forms42986.Droid", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = (ConfigChanges.ScreenSize ||| ConfigChanges.Orientation))>]
type MainActivity() =
override this.OnCreate (bundle: Bundle) =
Xamarin.Forms.Forms.Init (this, bundle)
this.LoadApplication (new Forms42986.App ())
let text = "coucou"
if isNull text
I tested on 3 computers, it always failed.
Created attachment 16897 [details]
failing test case
Oh my mistake, thanks for the info. I've updated the test case which now fails with the following. I am also able to reproduce the same failure with this project on Mac.
> FSC : error FS0219: The referenced or default base CLI library 'mscorlib' is binary-incompatible with the referenced F# core library 'C:\Users\xamarinqa\Desktop\Forms42986\packages\FSharp.Core.22.214.171.124\lib\portable-net45+monoandroid10+monotouch10+xamarinios10\FSharp.Core.dll'. Consider recompiling the library or making an explicit reference to a version of this library that matches the CLI version you are using.
> FSC : error FS0218: Unable to read assembly 'C:\Users\xamarinqa\Desktop\Forms42986\packages\FSharp.Core.126.96.36.199\lib\portable-net45+monoandroid10+monotouch10+xamarinios10\FSharp.Core.dll'
Diagnostic build output:
@Romain are these the same errors you're seeing?
Yes I have:
FSC : error FS0219: The referenced or default base CLI library 'mscorlib' is binary-incompatible with the referenced F# core library 'D:\prog\Forms42986\packages\FSharp.Core.188.8.131.52\lib\portable-net45+monoandroid10+monotouch10+xamarinios10\FSharp.Core.dll'. Consider recompiling the library or making an explicit reference to a version of this library that matches the CLI version you are using.
FSC : error FS0218: Unable to read assembly 'D:\prog\Forms42986\packages\FSharp.Core.184.108.40.206\lib\portable-net45+monoandroid10+monotouch10+xamarinios10\FSharp.Core.dll'
Thank you very much for your help
If you add a reference to mscorlib in your `*Droid.fsproj` does that resolve the issue?
> <Reference Include="mscorlib" />
Yes, it works.
I was going to update the templates to do this but I get 2 warnings :-
FSC: warning FS0217: The referenced or default base CLI library 'mscorlib' is binary-incompatible with the referenced library '/Users/jason/Projects/bug42986/Droid/../packages/Xamarin.Forms.220.127.116.11/lib/MonoAndroid10/FormsViewGroup.dll'. Consider recompiling the library or making an explicit reference to a version of this library that matches the CLI version you are using.
FSC: warning FS0217: The referenced or default base CLI library 'mscorlib' is binary-incompatible with the referenced library '/Users/jason/Projects/bug42986/bug42986/bin/Debug//bug42986.dll'. Consider recompiling the library or making an explicit reference to a version of this library that matches the CLI version you are using.
The app works fine when deployed on Android (all requests for mscorlib are redirected to use version 18.104.22.168) but the F# compiler complains. The C# compiler seems to just ignore this scenario.
So not sure what to do about this. I could add a `--nowarn FS2017` as the warning seems innocuous, but then that would mask potential genuine errors.
Uploaded test project here https://github.com/nosami/bug42986
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Android. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.