Beer and Xamarin.Forms – Creating a Xamarin.Forms Solution

In this lesson

  • Create a Solution with Xamarin Studio
  • Xamarin.Forms Solution Anatomy


Tap on time to skip ahead


Every Xamarin.Forms application begins by creating a new solution. You can think of a solution as a collection of projects that you will be using throughout the development of your project or application. You can create a new solution from the Xamarin Studio launch screen or you can select File, New Solution from the File menu, like so. You will then be presented with a wizard that will allow you to specify what type of project you want to initially start with in your solution. You can select a Cross-platform, an iOS, Android, Mac or various other .net projects, like command-line or ASP.NET.


For this, we are going to select a cross platform app using Xamarin.Forms and C#. Next, we name our application. Because our application is going to be showcasing the various local beers here in St. Louis, we are going to name it STL Brews. We can also change the organizational identifier for our application which will act as the default namespace for our code to com.brewers.stl because we’re going to use the reverse domain name convention.


Next, we are going to specify the target platforms we want to use. Because we’re doing Cross-platform we want both Android and iOS. Lastly on this screen, we can specify how we want to share our code across these two platforms. A shared library uses file links to allow iOS and Android to share code between the two of them. You can think of this as file include if you come from something like PHP or JavaScript, etc.


For this project, we’re going to use a portable class library. Basically, our core code is going to be compiled into a DLL that can then be referenced by both of our projects.


Next, we can give our project and solution different names, if we so choose. I like to have my main project have a different name from my solution, in that maybe down the road, I may want to create a web API for my application. This will kind of allow me to highlight mobile code versus maybe web code. From here, we can also change the location of where we want to add our solution, as well as specify whether or not we want to use git for version control.


The last two options on the screens are whether or not we want to include Xamarin Insights, which is Xamarin’s analytics and crash reporting product. Or we can use Xamarin Test Cloud that allows us to run our application on thousands of devices for QA purposes. We’re going to decline those two options for now.


Lastly, when I hit create, we will see Xamarin Studio is adding some various dependencies that we will need for our project. If you look over to the left you will see we have our core project that will have our business logic as well as our core UI code. Then, we have the individual project for Android and iOS.