FSharp.Mobile.Templates icon indicating copy to clipboard operation
FSharp.Mobile.Templates copied to clipboard

[Xamarin.Forms] iOS build errors in Visual Studio for Windows

Open gaelian opened this issue 3 years ago • 3 comments

Using Visual Studio for Windows (17.1.6). Installed FSharp.Mobile.Templates then ran:

> mkdir TestXamApp
> cd TestXamApp
> dotnet new xf-fsharp

Then added the generated projects to a blank Visual Studio solution. I've successfully downloaded the required dependencies from NuGet and GitHub Packages by editing the nuget.config file to add the relevant authentication details. Building the Android and shared projects is successful, but the iOS project reports these build errors:

FSC : error FS1108: The type 'UIView' is required here and is unavailable. You must add a reference to assembly 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'.
C:\Projects\TestXamApp\iOS\AppDelegate.fs(10,13): error FS0039: The type 'FormsApplicationDelegate' is not defined. Maybe you want one of the following:   UIApplicationDelegate   UIApplicationState   IUIApplicationDelegate
C:\Projects\TestXamApp\iOS\AppDelegate.fs(12,19): error FS0855: No abstract or interface member was found that corresponds to this override

The latter error is referring to the FinishedLaunching override in AppDelegate.fs. Am I doing something wrong, or should this be working?

gaelian avatar May 12 '22 09:05 gaelian

Disclaimer: .NET 6.0 mobile is not yet in a stable release, so all templates here are subject to breaking changes from Microsoft. Also while Xamarin.Forms on .NET 6.0 is technically feasible, I wouldn't recommend using it. Microsoft made a breaking change deep in Xamarin.iOS that requires a recompiled version of Xamarin.Forms.

TimLariviere avatar May 13 '22 13:05 TimLariviere

Not sure about UIView, but seems like you're missing the recompiled XF for .NET 6. It comes from a GitHub packages feed. Can you confirm it restored Xamarin.Forms v5.0.0.1 and not another version?

TimLariviere avatar May 13 '22 13:05 TimLariviere

Thanks for the reply @TimLariviere, I have double checked the projects in my test solution and while the shared and Android projects are using Xamarin.Forms 5.0.0.2337, the iOS project is using Xamarin.Forms 5.0.0.1. I didn't realise this recompiled package was only for iOS until you pointed this out.

While the package version seems to be correct for iOS, the same build errors persist: Screen Shot 2022-05-16 at 7 41 21 pm

gaelian avatar May 16 '22 09:05 gaelian