Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Xamarin using F# - Resource designer issue

Hi!
I'm trying and build a Xamarin.Forms application using F#.
When building on Android I got a bunch of FS1096 Errors (translating from italian, something like "Can't access class member, record or struct from here") on my autogenerated Resource.designer.fs file, though.
Now this makes sense, since those inaccessible fields are marked private (e.g. static val mutable private ActionBar:int[] or static val mutable private ActionBarLayout:int[] from the Resource_Styleable partial type).
Nevertheless, I'd need it to work, obviously. And I can't manually edit the Resource designer file cause with the next clear/build operation it will autogenerate itself.
Is there a way to fix this issue? Any workaround in order to get my F# Xamarin app to work?
If there are some Xamarin F# developers, here... Any help will be appreciate, thanks!
Jacopo

Posts

  • SamWilliamsSamWilliams USMember ✭✭
    Hi Jacopo,

    If your still have this problem, update to the latest version of Xamarin and create a new Android project. The new project will use the new template for Android which has been updated to use a type provider for Android resources, reading off the generated c# resources file (an F# resources file is no longer used as this causes the problems you listed, and more).

    If you can't migrate your existing Android project, just copy the details from the new project into your old project and then delete the new one. You will need update/add the following:
    Resources type provider nuget
    Fsproj file to use cs resource file (edit by hand)
    Resource type declaration (which can then be used to access the resources)

    hope this helps
    Sam
Sign In or Register to comment.