Ivan Rainbolt
Blog of Crazy Ivan

Follow

Blog of Crazy Ivan

Follow

Getting F# working in MAUI Blazor Desktop app

Ivan Rainbolt's photo
Ivan Rainbolt
·Jul 5, 2021·

1 min read

If you want to read my ramblings about my end goals, check my previous post of My views on app development

The idea was to try and get F# working so I can use it to do the logic. Based heavily on Bolero but I will use a different paradigm than Elmish most likely.

Step one was to get C# MAUI Blazor working. That involved installing the latest preview of .net6 and Visual Studio 2019 Preview. That also required installing a couple VISX modules to get working correctly. info link

Referencing Dan's post got me going and I eventually had the windows Blazor working.

I then added a new F# library project and tried to replace the root component of the C# type with a F# component from the referenced library. Took some work, but I have it working now. I put it up on GitHub in case it might help any one.

The sticky part was trying to figure out what is going on with

<b:RootComponent Selector="#app" ComponentType="{x:Type local:Main}" />

After many failed builds and some research, I added this line to the MainPage.xaml

xmlns:f="clr-namespace:MauiBlazorApp1.FSharp;assembly=FSharp"

and then changed the line to

ComponentType="{x:Type f:MyBasicApp }"

Bob's your uncle.

image.png

 
Share this