Bug 58371 - F# Forms Android Project Does Not Include FSharp.Core Package
Summary: F# Forms Android Project Does Not Include FSharp.Core Package
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Templates (show other bugs)
Version: 7.1 (d15-3)
Hardware: PC Mac OS
: Normal normal
Target Milestone: 15.4
Assignee: Matt Ward
URL:
: 59073 59879 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-07-25 15:18 UTC by Jimmy [MSFT]
Modified: 2017-10-01 13:17 UTC (History)
6 users (show)

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


Attachments

Description Jimmy [MSFT] 2017-07-25 15:18:29 UTC
The F# Forms Shared template does not add the FSharp.Core NuGet package to the Android project so the app does not compile out of the box. This is required now because Xamarin.Android 7.4 removed the FSharp.Core dll[1].

iOS is not affected because the dll is still shipped with Xamarin.iOS. The PCL template does not have this issue because it finds the dll from the PCL project, but it might still be worth referencing the package in that template as well.


### Steps to Reproduce
1. Create a new F# Forms Shared template solution
2. Build the Android project


### Expected Results
The project builds successfully.


### Actual Results
The build fails with 

> Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?


### Version Test
VS for Mac 7.1 build 1281


[1] https://developer.xamarin.com/releases/android/xamarin.android_7/xamarin.android_7.4/#FSharp.Core.dll_has_been_removed
Comment 1 Matt Ward 2017-07-27 12:45:22 UTC
Adding the FSharp.Core 4.0.0.1 NuGet package, which is used in the other Android projects, seems to cause the Android project to fail to build.

   FSC : error FS0219: The referenced or default base CLI library 'mscorlib' is binary-incompatible with the referenced F# core library '~/Projects/Tests/awegaewg32gweweg/packages/FSharp.Core.4.0.0.1/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 FS0229: Error opening binary file '~/Projects/Tests/awegaewg32gweweg/packages/FSharp.Core.4.0.0.1/lib/portable-net45+monoandroid10+monotouch10+xamarinios10/FSharp.Core.dll': The referenced or default base CLI library 'mscorlib' is binary-incompatible with the referenced F# core library '~/Projects/Tests/awegaewg32gweweg/packages/FSharp.Core.4.0.0.1/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.
    The command exited with code 1.


The non-Xamarin.Forms Android projects that have the same FSharp.Core NuGet package reference compile without any errors.

Updating to the latest stable FSharp.Core 4.2.1 causes a different build error, plus installs a load of extra NuGet packages since it uses .NET Standard.
Comment 2 Jimmy [MSFT] 2017-07-27 13:28:23 UTC
Right, I forgot to mention that in addition to including the package from NuGet, you need to add

<Reference Include="mscorlib" /> 

in the Android csproj otherwise you get that error in comment 1.
Comment 3 Matt Ward 2017-07-27 14:01:47 UTC
Thanks, Jimmy. That is why the other Android projects are working. The non-Forms Android projects all have the mscorlib reference.
Comment 5 xamarin-release-manager 2017-07-27 16:28:15 UTC
Fixed in version 7.3.0.149 (master)

Author: Matt Ward
Commit: 8c600ca9aced67485e77bd51973073863996718f (xamarin/md-addins)
Included in Commit: 1af8735d73a07bcfb602ac257384c0527981b3ea (mono/monodevelop)
Comment 6 Matt Ward 2017-08-03 20:18:45 UTC
Fix for d15-4 branch:

https://github.com/xamarin/md-addins/pull/2299
Comment 7 xamarin-release-manager 2017-08-04 09:28:34 UTC
Fixed in version 7.2.0.498 (d15-4)

Author: Matt Ward
Commit: e67debf4a9c0c9c955dc53e715832295822a0b34 (xamarin/md-addins)
Included in Commit: e74d1e0c280ed6f01dead8dc60afd98ef94af74b (mono/monodevelop)
Comment 10 Matt Ward 2017-08-27 14:30:53 UTC
*** Bug 59073 has been marked as a duplicate of this bug. ***
Comment 11 Matt Ward 2017-10-01 13:17:08 UTC
*** Bug 59879 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.