Before you can get started, you need to create an application. In this video, learn how to do just that. Plus, discover a few tips and tricks for working with Xamarin and F#.
- Let's get started creating our app. We have Xamarin Studio version 6.1.5 loaded up and now just have to click the new solution button to create the new project. Under multiplatform and app, we can choose a Xamarin forms app in F sharp, and hit next. I'm going to call the app UndoRedo. It'll target both Android and iOS, so leave these both checked and as mentioned previously, it's a good idea for the app to use a portable class library for the shared code. Click next, and here, we'll usually just leave the default names and locations.
Although in many cases we can choose to use Git for source control. So click create. Now that the project has loaded, let's quickly convert it to using paket and update our dependencies. We'll need to open a terminal window and we'll need to browse to the top folder in our project directory. We're currently in our project directory, so we need to change directories into the UndoRedo folder. From here we need to create a .paket directory and then we'll need to open chrome, and I already have the github page open for the paket download we need.
We'll need a copy of the paket bootstrapper. So we grab that. Let's head back to terminal and copy the bootstrapper file from our downloads directory, to our new .paket directory and then we will run our bootstrapper file. Because we're using mono on a Mac, we'll need to prefix the command with a call to mono. If you're using Windows, you don't need to include the mono prefix. Now that the bootstrapper has downloaded the latest version of paket itself, we can run the convert from new Git command.
That by calling paket itself, convert-from-nuget. This will look like it's failed. The scary error about unknown.NET moniker, but don't worry about it. The conversion has fully taken place. If we pop back to Xamarin Studio, you'll see it refreshing. You'll see that we have a new .paket folder containing a paket.dependencies file. And each of these projects now has a paket.references file as well. If we open the paket.dependencies file, it'll be clear where the errors come from.
As mentioned previously, when paket converts from nuget it makes a point of pinning every dependency to its current version, but it doesn't always get the details for Xamarin projects exactly right. Let's clean up the extra framework information, as well as the version numbers for each one of these lines. And the last one, and now we finally have all of the version information gone. Now that we've done that, we're able to run an update. So we can pop back over to terminal again and call mono .paket/paket.exe update.
Now paket will automatically go through and try to find the versions that work together. You can see it doing that with Xamarin.Forms right here. And popping back to Xamarin Studio once that's finished, you can see it loading and refreshing. Adding a few extra files and updating resources. And now you'll notice all the package updates are complete.
- Developing in F#
- Developing in Xamarin
- Developing in XAML
- Using Paket
- Creating an application
- Adding buttons and views
- Asynchronous workflows
- Adding a mailbox processor to an app
- Modifying the core code
- Adding a reply feature to an app