To install the templates for Fabulous for Xamarin.Forms, run the following command:
dotnet new install Fabulous.XamarinForms.Templates
You can check the installed templates on your machine by running the command:
dotnet new list
You should see the installed Fabulous for Xamarin.Forms templates:
Template Name Short Name Language Tags
---------------------- ----------------- -------- ----------------------
Fabulous XF Blank fabulous-xf F# Fabulous/Xamarin.Forms
Fabulous XF VS Windows fabulous-xf-vswin F# Fabulous/Xamarin.Forms
If you are using Visual Studio on Windows, we recommend that you use the template
fabulous-xf-vswin. This template uses the
nuget.configfile to reference dependencies, instead of
PackageReference, to ensure compatibility with Visual Studio.
To get started, we are going to use the simplest Fabulous for Xamarin.Forms template:
Fabulous XF Blank(or
fabulous-xfin the CLI).
Run the command:
dotnet new fabulous-xf -n GetStartedApp
This will create a new folder called GetStartedApp containing the new project.
In this folder, you'll find a shared project
GetStartedAppas well as 2 other folders
GetStartedApp.iOScontaining the head projects that will produce the application for the corresponding platform.
The templates only include Android and iOS projects, but Fabulous is also compatible with any platform supported by Xamarin.Forms such as WPF, macOS and Linux. See the official Xamarin.Forms documentation for more information.
To run a project, we recommend you open the solution
GetStartedApp.slnwith your favorite IDE.
Once loaded, you'll be able to select which project to run (Android or iOS) along with the emulator or device to run on.
Press the debug button to deploy and run the application.
Please note that due to some limitations between F# and Xamarin, the Android project will fail to build the first time because of missing resources. Please build a second time to be able to debug.