Fabulous icon indicating copy to clipboard operation
Fabulous copied to clipboard

Cannot build default Android project from template

Open replicaJunction opened this issue 3 years ago • 4 comments

I'm brand new to both Xamarin and Fabulous and trying to get my feet wet, but I can't compile the default Android project in the template without making any modifications.

Environment

Tested with these Fabulous template versions:

  • 0.57.0
  • 0.60.0-preview2
  • 0.60.0-preview3

dotnet SDK version: 5.0.100

Visual Studio version:

Microsoft Visual Studio Community 2019 Version 16.8.0 VisualStudio.16.Release/16.8.0+30709.132 Microsoft .NET Framework Version 4.8.04084

Installed Version: Community

Steps to Reproduce

Run these steps (I did it from within PowerShell, but I assume a regular command prompt would work as well):

> dotnet new -i Fabulous.XamarinForms.Templates::0.60.0-preview3

> dotnet new fabulous-xf-app -n FabulousTest --iOS=false
The template "Fabulous Xamarin.Forms App v0.60.0-preview3" was created successfully.

Processing post-creation actions...
Template is configured to run the following action:
Description:
Manual instructions: Run 'dotnet tool restore' to install fabulous-cli
Actual command: dotnet tool restore
Do you want to run this action (Y|N)?
y
Running command 'dotnet tool restore'...
Command succeeded.

Now, open the solution in Visual Studio and try to build the Android project. Below is the output I get in the Build window:

1>------ Build started: Project: FabulousTest, Configuration: Debug Any CPU ------
1>C:\Users\UserName\.nuget\packages\xamarin.forms\4.8.0.1269\buildTransitive\Xamarin.Forms.targets(227,5): warning : Xamarin.Forms recommends TargetPlatformMinVersion >= 10.0.14393.0 (current project is -1)
1>C:\Users\UserName\.nuget\packages\xamarin.forms\4.8.0.1269\buildTransitive\Xamarin.Forms.targets(233,5): warning : Xamarin.Forms recommends TargetPlatformVersion >= 10.0.17763.0 (current project is -1)
1>FabulousTest -> D:\Documents\Projects\FabulousTest\FabulousTest\bin\Debug\netstandard2.0\FabulousTest.dll
1>Done building project "FabulousTest.fsproj".
2>------ Build started: Project: FabulousTest.Android, Configuration: Debug Any CPU ------
2>		No way to resolve conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
2>FSC: error CS1703: An assembly with the same identity 'System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' has already been imported. Try removing one of the duplicate references.]
2>parse error FS3053: error : The type provider constructor has thrown an exception: [error CS1703: An assembly with the same identity 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' has already been imported. Try removing one of the duplicate references.; error CS1703: An assembly with the same identity 'System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' has already been imported. Try removing one of the duplicate references.]
2>FSC: warning FS3005: Referenced assembly 'D:\Documents\Projects\FabulousTest\packages\Xamarin.Android.FSharp.ResourceProvider.1.0.0.28\lib\monoandroid81\Xamarin.Android.FSharp.ResourceProvider.Runtime.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found
2>Done building project "FabulousTest.Android.fsproj" -- FAILED.
2>
2>Build FAILED.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I'm assuming I'm just doing something wrong - surely if the template was broken, someone else would have reported it by now - but I have no idea what. Is there anything I can do to troubleshoot this issue?

replicaJunction avatar Nov 12 '20 04:11 replicaJunction

Tested it on mac but everything works as expected...

Will try it on Windows asap.

SergejDK avatar Nov 12 '20 12:11 SergejDK

Thanks for the report. I'm suspecting it is linked to VS 16.8. I saw the same stack trace shared yesterday on the F# Slack channel.

TimLariviere avatar Nov 12 '20 12:11 TimLariviere

I confirm that's an issue with VS 16.8.

I tested with VS 16.7.3 (MSBuild 16.7.0.37604), it compiled and debugged fine. I updated to VS 16.8.0 (MSBuild 16.8.1.52902), it fails to build with the exact same message as posted in the initial comment.

TimLariviere avatar Nov 12 '20 17:11 TimLariviere

A workaround seems to be to remove both System and System.Numerics from the References in the Android project.

TimLariviere avatar Nov 12 '20 17:11 TimLariviere